我有一个按钮,当点击,启动事件。问题是,如果我按2-5次,事件将被触发同样的次数。
我试了几个选择:
buttonHendler: function() {
this.fireEvent('myEvent',param,callback,2000)
}
buttonHendler: function() {
Ext.Function.createBuffered(this.fireEvent('myEvent',param,callback), 2000, this)
}但似乎不起作用。如有任何意见,我将不胜感激。
发布于 2022-08-31 18:48:07
我们在执行按钮应该做的任何事情时挂起按钮事件,然后重新启动事件。额外的奖励添加一个旋转图标。
// can be in a singleton class or add to your own button or whereever.
addButtonProcessing: function(button) {
button.prevIconCls = button.getIconCls();
button.prevText = button.getText();
button.setIconCls('x-fa fa-spin fa-sync');
button.suspendEvents(); // To prevent double click
},
removeButtonProcessing: function(button) {
button.setIconCls(button.prevIconCls);
button.setText(button.prevText);
button.removeCls('x-pressing');
button.resumeEvents();
},所以在按钮处理程序中:
// if the methods are in the viewport controller.
Ext.Viewport.getController().addButtonProcessing(button);
// do something
Ext.Viewport.getController().removeButtonProcessing(button);https://stackoverflow.com/questions/73558113
复制相似问题