Custom Adapter for webapi - Intercepting only the get request

I have a webapi backend and a grid javascript frontend

my controller looks like this 



and on client i get this 


and it works great with this 



So far no problem.

Now i want to return this from my controller 



but I cant extract my custom property "ColumnDefinition" on the client side



How can i extract or access my property "ColumnDefinition" while everything else keeps working as ususal?
Maybe the question is how can i intercept only the get request while leaving the rest to behave as usual?

Thank you



1 Reply

MS Madhu Sudhanan P Syncfusion Team February 12, 2019 07:13 AM UTC

Hi Samuel, 

Thanks for contacting Syncfusion support. 

You can access the custom/additional properties send to client by extending the processResponse method of the WebApiAdaptor as follows.  


    var customAdaptor = new ej.data.WebApiAdaptor(); 
     
    //Extend the web api adaptor. 
    ej.base.extend(customAdaptor, { 
      processResponse: function(data, ds, query, xhr, request, changes) { 
        let customProperty = data.ColumnDefinition; //Get the custom property here. 
        return ej.data.WebApiAdaptor.prototype.processResponse.call(this, data, ds, query, xhr, request, changes) 
      } 
    }); 
 
    var data = new ej.data.DataManager({ 
        url: hostUrl + 'api/Orders', 
        adaptor: customAdaptor, 
        crossDomain: true 
    }); 



Regards, 
Madhu Sudhanan P 


Loader.
Up arrow icon