存储器的侦听器功能在网格更新两次 [英] Listener function for store fires twice on update in grid

查看:73
本文介绍了存储器的侦听器功能在网格更新两次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可编辑的Ext网格面板。它使用的商店有一个监听器,当记录更改时触发一个功能:

 监听器:{
更新: someFunction
},

该函数更改了存储中的某些值,因此该函数被触发再次。
有没有办法运行一次功能?
也许使用另一个听众?

解决方案

我已经通过添加

  store.removeListener('update',someFunction); 

在功能开始时更改商店中的价值:

  store.addListener('update',someFunction); 

最终。



也许那里是一个更好的方法?


I have a editable Ext grid panel. The store it uses has a listener that fires a function when a record is changed:

listeners:{
    update: someFunction
    }, 

The function changes some values in the store, so the function is fired again. Is there a way to run the function once? Maybe to use another listener?

解决方案

I've achieved this by adding

store.removeListener('update', someFunction);

in the beginning of the function changing the value in the store and:

store.addListener('update', someFunction);

in the end.

Maybe there is a better way?

这篇关于存储器的侦听器功能在网格更新两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆