简体   繁体   English

Ext.js动态更新GridPanel行记录

[英]Ext.js Dynamically update GridPanel row record

I am working on how to dynamically update a GridPanel record in in ext.js using native JavaScript ofcourse. 我正在研究如何使用本机JavaScript当然在ext.js中动态更新GridPanel记录。 So, I check the Ext.data.Store objects many properties and methods and there does not seem to be an update method. 因此,我检查了Ext.data.Store对象的许多属性和方法,但似乎没有更新方法。 However, there is a remove, and an add method. 但是,有一个删除和一个添加方法。 Is the only way to update the record in the grid, to first remove the existing copy of it and then add the updated record to the GridPanel as if it were new? 是更新网格中记录的唯一方法,首先删除它的现有副本,然后将更新后的记录添加到GridPanel中,就好像它是新记录一样吗?

Thanks in advance. 提前致谢。

You need to get the record first, for example: 您需要首先获取记录,例如:

grid.getStore().getAt(0).set({yourFieldName:'new value'});

There's no need to remove the record, update it and add it back, just update it in-place as above. 无需删除记录,对其进行更新并将其添加回去,只需如上所述就地进行更新即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM