Search code examples
angularjsdevexpressdevextremedx-data-grid

Apply external changes to dxDatagrid with Batch Edit mode


I have a datagrid configured with Batch Edit mode. When I send some request to my server, it replies with computed new values that I'd like to apply to my datagrid with Batch Edit mode features (green border around the cell, "Save changes" button enabled). I managed to make it work by browsing the grid and updating the cells with gridInstance.cellValue(...) to get the desired behavior. Right now it works well on short samples of data that fits on one single page, but I have issues when the sample is big enough to require multiple pages (only 10 items are displayed on each page). I thought about going through each page of the grid to browse its rows, but it seems a bit dirty to me and I'm concerned about the performances.

A nicer way would be to browse through the datasource instead of the datagrid and add some flag to the rows that need to be updated, and then refresh/repaint the datagrid. How can I achieve this? Or if we can't use flags or something similar, what is the proper way to update the whole grid no matter the number of pages?


Solution

  • Response from the DevExpress support:

    This behavior is a known limitation of our components. The cellValue method is designed to modify visible rows only. We are going to update our documentation to make it clearer. As a possible approach, you can update rows via a data source layer using the update method. Meanwhile, since you use the batch edit mode, I wish to note that when the update method is used, rows will be changed without the ability to undo modifications. We are going to research if we can improve DataGrid functionality for this scenario in further versions.

    For now, it looks like the only solution is to use the update method and lose the batch edit "undo" feature, or browse through the pages with the cellValue.