Reputation: 135
The app I'm working on uses Syncfusion EJ2 Grids with data loaded by our code and passed to the Grid for rendering. I don't know why it was written this way and not with the DataManager class available, but it's how things are.
I want to move some things to using a DataManager to more easily enable pagination and advanced sorting/filtering, but since the server requires all requests to have an Access-Token
header (no, I don't understand why we don't use cookies, but I don't have control over that), I need to be able to add that header to outgoing requests.
I've searched the documentation, particularly:
I've also checked out the provided types for both the DataManager and the ODataAdaptor, but the parameters are un-commented and none of them seem like a viable option.
Upvotes: 1
Views: 382
Reputation: 344
Here is one approach, tested using Vue3 data grid:
const dm = new DataManager({
adaptor: new UrlAdaptor(),
url: '/api/data',
batchUrl: '/api/batch',
headers: [
{ HeaderName: "value" }
]
});
Upvotes: 1
Reputation: 135
So apparently I'm blind. There is a headers
property under the DataOptions
type, and my eyes just skipped over it.
Lesson learned: Don't rubber-ducky to StackOverflow, you'll just embarrass yourself.
Upvotes: 0