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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

DataManager accepting a Promise

Thread ID:





147781 Sep 23,2019 12:09 PM UTC Jan 9,2020 01:03 PM UTC JavaScript - EJ 2 5
Tags: DataManager
z q
Asked On September 23, 2019 12:09 PM UTC

This applies to any component that can use the DataManager as datasource.

I have a service which returns a promise  then fetches data from a server to be resolved later.

I want to create a new adaptor which returns a promise to the data manager.

Does the datamanager support receiving promises from its adaptor?

Thavasianand Sankaranarayanan [Syncfusion]
Replied On September 24, 2019 11:45 AM UTC

Hi Customer, 

Greetings from Syncfusion support. 

Based on your query, we suspect that you want to create a own adaptor which returns a promise to the data manager. We have already discussed about your requirement in our documentation. Please find the below documentation link for more information. 

Thavasianand S. 

z q
Replied On September 24, 2019 10:00 PM UTC

I have looked at https://ej2.syncfusion.com/javascript/documentation/grid/data-binding/#custom-adaptor 

but in processQuery()

I dont see where you can return a Promise to processQuery() does processQuery() accept a Promise?

I tested it again. Within the processQuery() method I returned a new promise. ProcessResponse was immediately called. 

public processQuery(dataManager: DataManager, query: Query): Object {
const def = new Deferred();

.then((result) => {
def.resolve({ result: result.slice(0, 50), count: 50 });
}).catch((error) => {
def.reject({ result: [], count: 0 });

return def.promise;

Thavasianand Sankaranarayanan [Syncfusion]
Replied On September 25, 2019 11:47 AM UTC

Hi Customer, 

ProcessQuery: ProcessQuery is used to convert the query in property format(syntax) based on its adaptor. Also it send the request to the server. 


ProcessResponse: If the request gets success it returns the data(from server) to the processResponse method based on your query processing. Please refer the below screenshot and refer the below documentation link for more information. 


Thavasianand S. 

Replied On January 8, 2020 03:41 PM UTC

For anyone else that might be looking into this. To handle Async calls you will have to do that request in makeRequest method of your custom adapter. As you can see defferred is passed in. 

If you look at manager.js code you will see that executeQuery  checks if adaptor has `makeRequest`  defined and if so it calls it with `(result, deffered, args, query)`
if (!this.dataSource.offline && (this.dataSource.url !== undefined && this.dataSource.url !== '')
|| (!isNullOrUndefined(this.adaptor[makeRequest]))) {
var result = this.adaptor.processQuery(this, query);
if (!isNullOrUndefined(this.adaptor[makeRequest])) {
this.adaptor[makeRequest](result, deffered, args, query);
else if (!isNullOrUndefined(result.url)) {
this.makeRequest(result, deffered, args, query);
else {
args = DataManager.getDeferedArgs(query, result, args);
else {
DataManager.nextTick(function () {
var res = _this.executeLocal(query);
args = DataManager.getDeferedArgs(query, res, args);
if (done || fail) {
deffered.promise.then(done, fail);
if (always) {
deffered.promise.then(always, always);
return deffered.promise;

Dhivya Rajendran [Syncfusion]
Replied On January 9, 2020 01:03 PM UTC

Hi Faruk, 

Yes, We have send the post to the server through an makeRequest method. Please share us on what you are expecting to achieve and tell us in which way you are going to customize. 

R. Dhivya 


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