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

Can I get other value from Datamanager ?

Thread ID:

Created:

Updated:

Platform:

Replies:

141282 Dec 4,2018 09:41 AM UTC Dec 5,2018 11:14 AM UTC Angular - EJ 2 1
loading
Tags: Grid
lorryl
Asked On December 4, 2018 09:41 AM UTC

I am using datamanager to binding remote data, 


In my webAPI, I return follow:


How can I get the currentLogon and allUser ?




Madhu Sudhanan P [Syncfusion]
Replied On December 5, 2018 11:14 AM UTC

Hi Lorryl, 

Thanks for contacting Syncfusion support. 

You can access the additional data from the request by overriding the processResponse method of the WebApiAdaptor. Now the custom adaptor to intercept the response data before processing will be as follows. 


import { DataManager, WebApiAdaptor, DataResult, DataOptions, Query, CrudOptions } from '@syncfusion/ej2-data'; 
import { Ajax } from '@syncfusion/ej2-base'; 
 
class CustomAdaptor extends WebApiAdaptor { 
 
  public processResponse(data: DataResult, ds?: DataOptions,  
    query?: Query, xhr?: XMLHttpRequest, request?: Ajax, changes?: CrudOptions): Object { 
          let currentLogon = data["currentLogon"]; 
          let allUser = data["allUser"]; 
 
          return super.processResponse(data, ds, query, xhr, request, changes); 
        } 
} 
 
@Component({ 
    selector: 'control-content', 
    templateUrl: 'remote-data.html' 
}) 
export class DataBindingComponent implements OnInit { 
   ..... 
 
    ngOnInit(): void { 
        this.data = new DataManager({ url: SERVICE_URI + 'api/Orders', adaptor: new CustomAdaptor }); 
    } 
} 



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

;