Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
815
Add HTTP Headers to igGrid dataSource
posted

I have an igGrid with the dataSource property set, but I can't find a way to add a custom HTTP Header.

For example, see below for my grid:

$("#GRIDUsers").igGrid({
        columns: [
            { headerText: "Options", key: "Options", dataType: "string", width: "100px", unbound: true, template: optionString },
            { headerText: "ID", key: "ID", dataType: "string", hidden: true },
            { headerText: "Effective Date", key: "EffectiveDate", dataType: "date", width: "130px" },
            { headerText: "Frequency", key: "Frequency", dataType: "string", hidden: true },
            { headerText: "Client", key: "ClientName", dataType: "string" },
            { headerText: "Status", key: "Status", dataType: "string", width: "120px" },
            { headerText: "Service", key: "ServiceType", dataType: "string", hidden: true },
            { headerText: "Action", key: "ActionType", dataType: "string" },
            { headerText: "Notes", key: "Notes", dataType: "string", template: "<p class='grid-fixed-row-height'>${Notes}</p>" },
            { headerText: "Created By", key: "CreatedBy", dataType: "string" },
            { headerText: "Created On", key: "CreatedTS", dataType: "date", width: "120px" }

        ],
        responseDataKey: "0.d",
        autoCommit: true,
        width: "auto",
        height: "400px",
        autoGenerateColumns: false,
        renderCheckboxes: true,
        primaryKey: "ID",
        dataSource: "https://mywebsite.com/api/Users"
    });

The problem is that my API is expecting an HTTP Header called "APIKey" with a string value such as "12345". How can I add this HTTP Header?

Parents Reply Children