ej2-syncfusion

How can I add headers to the requests made by a DataManager using the OData adaptor?


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.


Solution

  • 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.