Datamanager overwrite update or makeRequest for posting data

Is there a way to modify the post data of data manager?

I want to post only the "value" not including action, key, and keyfield.


6 Replies

PS Pavithra Subramaniyam Syncfusion Team August 3, 2022 03:33 PM UTC

Hi Jayson Cabrera,


Thanks for contacting Syncfusion support.


You can achieve your requirement by overriding the default payload inside the “beforeSend” method using the “Custom Adaptor” feature. Please refer to the below code example and sample link for more information.


export class CustomAdaptor extends UrlAdaptor {

  beforeSend(data, ds, ajax, xhr, request, changes) {

    var val = JSON.parse(ajax.data).value;

    if (val) {

      ajax.data = JSON.stringify(val);

    }

    return super.beforeSend.apply(this, arguments);

  }

}

 

// Grid DataSource

 

this.data = new DataManager({

  adaptor: new CustomAdaptor,

  url: 'Home/UrlDataSource'

});

 

 


https://ej2.syncfusion.com/react/documentation/grid/data-binding/remote-data/#custom-adaptor


Please get back to us if you need further assistance on this.


Regards,

Pavithra S



MW Madden Wayne September 17, 2024 02:19 AM UTC

In Syncfusion, particularly with their data management components like DataManager, you might need to update or post data using methods like overwrite, update, or makeRequest. 

You can make requests using the DataManager instance by specifying the type of request (e.g., post, put, delete) and the necessary data.

// Example to POST data

dataManager.executePost({

    url: 'https://your-api-endpoint',

    data: { key: 'value' },

    adaptor: new UrlAdaptor()

}).then((e) => {

    console.log('Data posted successfully:', e);

}).catch((error) => {

    console.error('Error posting data:', error);

});

See more similar thread https://www.syncfusion.com/forums/154499/how-to-trigger-datamanager-reload-when-url-changes slice master

After executing any of these requests, handle the response accordingly. Syncfusion’s DataManager methods return promises, so use .then() and .catch() to process results or handle errors.




AR Aishwarya Rameshbabu Syncfusion Team September 17, 2024 04:18 PM UTC

Hi,


In response to the query posted in this forum, pass the data through the DataManager’s post request. We have fulfilled this requirement(I want to post only the "value" not including action, key, and keyfield) by overriding the beforeSend method of UrlAdaptor, extended using a CustomAdaptor. This approach ensures data is posted in the desired format.

In the last update, there is a suggestion involving a method named `executePost`, which does not exist within DataManager. Consequently, using the provided code lines, we were unable to address the initial query reported in this forum. Instead, DataManager includes a method called `executeQuery`; however, this requirement can only be met through the beforeSend method. Therefore, we kindly recommend utilizing the solution provided in our initial update.


Regards

Aishwarya R



EL elonmaskx June 28, 2025 03:17 AM UTC

Consequently, using the provided code lines, we were unable to address the initial query reported in this forum. Instead, DataManager includes a method called `executeQuery`; however, this requirement can only be met through the beforeSend method. Therefore, we kindly recommend utilizing the solution provided in our initial



MH Marry Hile September 8, 2025 05:10 PM UTC

In response to the query posted in this forum, pass the data through the DataManager’s post request. We have fulfilled this requirement(I want to post only the "value" not including action, key, and keyfield) by overriding the beforeSend method of UrlAdaptor, extended using a CustomAdaptor. This approach ensures data is posted in the desired format.




DM Dineshnarasimman Muthu Syncfusion Team September 9, 2025 10:39 AM UTC

 

Hi,


We were glad that your requirement has been achieved. Please get back to us for further assistance.

 

Regards,

Dineshnarasimman M


Loader.
Up arrow icon