我有一个可编辑的 Ext 网格面板。它使用的商店有一个监听器,当记录更改时会触发一个函数:
listeners:{
update: someFunction
},
该函数更改了存储中的一些值,因此再次触发了该函数。 有没有办法运行该功能一次? 也许使用另一个监听器?
最佳答案
检查 ExtJS Store documentation , 你可能想看看 beforesave
事件(强调我的):
Fires before a save action is called. A save encompasses destroying records, updating records and creating records.
或者你可以使用...
store.addListener('update', someFunction, store, {single: true});
...确保回调函数仅在下次调用 update
时发生。
关于extjs - 商店的监听器功能在网格更新时触发两次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5127251/