使用批量编辑模式将外部更改应用到 dxDatagrid

Apply external changes to dxDatagrid with Batch Edit mode

我有一个配置了批量编辑模式的数据网格。当我向我的服务器发送一些请求时,它会回复计算出的新值,我想将这些值应用到我的具有批编辑模式功能的数据网格(单元格周围的绿色边框,"Save changes" 按钮已启用)。我设法通过浏览网格并使用 gridInstance.cellValue(...) 更新单元格以获得所需的行为来使其工作。现在它适用于适合一页的短数据样本,但当样本大到需要多页时(每页仅显示 10 个项目),我会遇到问题。我考虑过遍历网格的每一页来浏览它的行,但对我来说似乎有点脏,我担心性能。

更好的方法是浏览数据源而不是数据网格,并向需要更新的行添加一些标志,然后 refresh/repaint 数据网格。我怎样才能做到这一点?或者,如果我们不能使用标志或类似的东西,无论页面数量如何,更新整个网格的正确方法是什么?

DevExpress 支持的回复:

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.

目前看来,唯一的解决办法是使用更新方法并取消批量编辑 "undo" 功能,或者使用 cellValue.

浏览页面