We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Does DataManager support OData v4?

Thread ID:





117024 Jul 22,2014 04:12 AM UTC Jul 25,2014 01:35 PM UTC JavaScript 1
Tags: ejGrid
Asked On July 22, 2014 04:12 AM UTC

If I provide OData v4 via WEP API 2.2, I wonder that does DataManager support it?

Mohammed Farook J [Syncfusion]
Replied On July 25, 2014 01:35 PM UTC

Hi Kevin


Thanks for using Syncfusion Products,


Sorry for the inconvenienced.  currently  ejDataManager doesn’t  have support to handle OData V4, but we can achieve your requirement with the help of custom adaptor by extending default ej.ODataAdaptor. please follow the code snippet.


We can extend the ej.OdataAdaptor as follows.



var ODataV4Adaptor = new ej.ODataAdaptor().extend({

    options: {

        count: "$count",

        search: "$search"


    onCount: function (e) {

        return e === true ? "true" : "";





beforeSend function will  be trigger the event before every server request.



beforeSend: function (dm, request, settings) {  //Will be triggered before every request to server.

        // some services do not support custom header on crossDomain (CORS) request

        if (!dm.dataSource.crossDomain) {

            request.setRequestHeader("DataServiceVersion", "4.0");

            request.setRequestHeader("MaxDataServiceVersion", "4.0");






processResponse is used to process the response to the server


processResponse: function (data, ds, query, xhr, request) { //used to process the response from server

        var count;

        if (query && query._requiresCount) {

            count = data['@odata.count'];

            data = data.value;


        return ej.isNullOrUndefined(count) ? data : { result: data, count: count };






In the grid load event, we can assign the custom adaptor to the grid datamanager as follow.



        .Datasource(ds => { ds.URL("http://services.odata.org/V4/Northwind/Northwind.svc/Orders/").CrossDomain(true); })//"http://services.odata.org/V4/Northwind/Northwind.svc/Orders/")

        .ClientSideEvents(eve => eve.Load("load").ActionComplete("CompleteHandler").ActionBegin("BeginHandler"))






    refContent = false;

    function load(args) {

        args.model.dataSource.adaptor = new ODataV4Adaptor;





Sample Location :  MvcApplication4.zip


Please let us know if you have any queries.


Thanks with Regards,

J.Mohammed Farook






This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon