extjs - 商店的监听器功能在网格更新时触发两次

我有一个可编辑的 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 时发生。

https://stackoverflow.com/questions/5127251/

相关文章:

macos - undefined symbol : "boost::system::generic

visual-studio-code - 如何在 visual studio 代码中显示完整的长行(

perl - Perl 中的并行计算

python - 如何在 Python 的特定范围内替换数据框中的数字?

scala - 如何使用 Scala 在 lagom 中为 NoHostAvailableExcep

selenium-webdriver - 在 Heroku 上使用 webdrivers selen

forms - 如何使用 cakephp 和 twitter bootstrap 在 poSTLin

visual-studio-2015 - IApplicationBuilder 不包含 UseWe

extjs - 在绑定(bind) View 中应用条件

azure - 使用 Azure SQL 的 ASP.Net Core 2.1 Serilog SQ