Ticket T229551
Visible to All Users

dxDataGrid - How to send all changes in a single request

created 10 years ago

Hi,
I implemented a custom store where each function calls a designated service that talks to WebAPI and everything works great.
However, I noticed is that each change to a row (new,update,delete) is translated to a specific call to the server. Meaning, if I have 100 changes and I click save - my grid will generate 100 calls to the server. It's a big overhead.

So, What is the best approach for handling the batch save that sends all the data in one request ?
The way I see it, I have to use custom store. For each method in the custom store (update,create etc.) i'll have to manually manage the change, and in the end send all the datasource back to the server for further processing. I was thinking about adding a State to each row so that the server would know what was changed.

any walk-through and examples would be really appreciated.

Thanks

Ron

Answers approved by DevExpress Support

created 10 years ago (modified 5 years ago)

Hi Ron,

There is no best approach for your scenario, because dxDataGrid does not support it out of the box. A possible workaround is to set a timer and store all data that is passed to the CustomStore.update method. Then, when the timer callback function is called, send data for all update operations to your data service in a single request using jQuery.ajax.

See the CodePen sample.

See also:
dxDataGrid - How to implement a custom store with CRUD operations

    Show previous comments (8)
    DevExpress Support Team 8 years ago

      Hi Jason,

      What do you mean by "the grid is loaded"? Is the Custom Store load method called even if updating is rejected? I can't reproduce this issue with my sample. I've attached a screencast to illustrate this. Would you please elaborate on the issue?

        Hi. I have the same problem.
        I want to send all the data to the server at once. On your site I found several solutions. But it looks like a temporary solution.

        I think developers сould add an event that can be used to determine if the save was complited.
        Are there another methods for solving the problem Now?

        DevExpress Support Team 7 years ago

          Hi Mike,

          At the moment, there is no special API for this task. Please use the solution suggested in this ticket.
          We will think about adding the required methods in future versions.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.