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

How to access batch update response from server?

In our solution we are making great usage of the grid's batch editing through the DataManager and UrlAdaptor.  On the server when we perform the batch update, we may embed some details into the result of the call.  How can we gain access to the result that comes back?

For example.  If the user removes 10 records in the grid and triggers the update command to tell the server, the server may remove 8 because 2 of them are unable to be removed for business rule related reasons.  The response will still come back as a success but with information that 2 of the records were not removed.

How can we gain access to the response to check some of the details?

We see there is an actionFailure event, but in our case, this would not be a failure.  We see there is an actionComplete event, but does it contain any response information from the server call?

Thanks,
:JV


1 Reply

PS Pavithra Subramaniyam Syncfusion Team March 10, 2023 04:08 AM UTC

Hi Jeff Voigt,


Thanks for contacting Syncfusion support.


You can get the server response using the “Custom Adaptor” feature which allows you to override the default “processResponse” method of the UrlAdaptor. Please refer to the below code example and documentation link for more information.


export class SerialNoAdaptor extends UrlAdaptor {

    processResponse() {

        let i = 0;

        /* calling base class processResponse function */

        const original = super.processResponse.apply(this, arguments);

        /* Adding serial number */

        original.result.forEach((item) => setValue('Sno', ++i, item));

        return { result: original.result, count: original.count };

    }

}

 


Documentation: 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


Loader.
Live Chat Icon For mobile
Up arrow icon