Dojo Datagrid 总是显示过时的数据
我正在使用通过 dojo.data.ObjectStore 和 dojo.store.Cache 连接到 dojo.store.JsonRest 的 Dojo Datagrid。还有一个 dojo.store.Memory 连接到 Cache 存储。
数据网格可通过下拉菜单进行编辑。第一次更改值时,一切似乎都很顺利,但如果您第二次编辑同一行,则编辑会传递到 JsonRest 和服务器,但网格本身会恢复显示旧值。
这是一个已知的错误吗?有解决方法的想法吗?
I am using a Dojo Datagrid connected to a dojo.store.JsonRest through an dojo.data.ObjectStore and a dojo.store.Cache. There is also a dojo.store.Memory connected to the Cache store.
The datagrid is editable with drop-downs. The first time a value is changed, everything seems to go fine, but if you edit the same row a second time, the edit goes through to the JsonRest and to the server, but the grid itself reverts back to displaying the old value.
Is this a known bug? Any ideas for a workaround?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将数据保存到服务器后,您可以使网格更新行。回调可以是这样的:
希望有帮助
You could make the grid update row after saving your data to server. A callback can be like:
Hope it helps
如果没有看到您的代码,很难说为什么更改没有被持久化。请记住,DataGrid 依赖统一的数据接口将更改写回数据存储。编辑单元格后,更改将通过 Dojo 数据适配器的 setValue() 方法写回;未保存的更改将存储在适配器中,直到您调用 save() 方法: dataStore.save();调用 save() 后,所有更改都会通过 put() 调用传递到对象存储。要记住的是,网格只是显示/反映存储中的数据。因此,除非更改已在底层存储中永久化,否则编辑网格中的单元格将不会持久。
Without seeing your code it's hard to say why the changes aren't being persisted. Keep in mind that the DataGrid relies on the uniform data interface to write the changes back to the data store. Once you have edited a cell, the changes are written back through the Dojo data adapter's setValue() method; unsaved changes are stored in the adapter until you call the save() method: dataStore.save(); Once save() is called, all the changes are delivered to the object store via put() calls. The thing to keep in mind is that the grid is just displaying/reflecting the data in the store. So editing cells in the grid will not persist unless the changes have been made permanent in the underlying store(s).