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

Custom Adapter for webapi - Intercepting only the get request

Thread ID:

Created:

Updated:

Platform:

Replies:

142598 Feb 11,2019 09:05 PM UTC Feb 12,2019 07:13 AM UTC JavaScript - EJ 2 1
loading
Tags: Grid
Samuel
Asked On February 11, 2019 09:05 PM UTC

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



Madhu Sudhanan P [Syncfusion]
Replied On 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 


CONFIRMATION

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

This page will automatically be redirected to the 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

;