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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to set withCredentials is true when new datamanager ?

Thread ID:

Created:

Updated:

Platform:

Replies:

141560 Dec 18,2018 07:47 AM UTC Dec 19,2018 08:37 AM UTC Angular - EJ 2 1
loading
Tags: Grid
lorryl
Asked On December 18, 2018 07:47 AM UTC

My GetData method need to add withCredentials into headers, what should I do when using datamanger binding grid ?

Madhu Sudhanan P [Syncfusion]
Replied On December 19, 2018 08:37 AM UTC

Hi Lorryl, 

Thanks for contacting Syncfusion support. 

You can use the custom adaptor to set withCredential to the DataManager requests. If you are using UrlAdaptor then the custom adaptor to achieve this behavior will be as follows. 


import { DataManager, UrlAdaptor } from '@syncfusion/ej2-data'; 
 
class CustomAdaptor extends UrlAdaptor { 
  public beforeSend(args: DataManager, xhr: XMLHttpRequest) { 
     xhr.withCredentials = true; 
     super.beforeSend(args, xhr); 
  } 
} 

ngOnInit(): void { 
    this.data = new DataManager({ 
      ..., 
      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

Live Chat Icon For mobile
Live Chat Icon