【发布时间】:2013-08-15 19:03:40
【问题描述】:
使用 ExtJS 4,我有一个 Ext.Button 和一个需要一段时间才能运行的处理程序函数。在它运行时,按钮看起来像是被按下了,而光标一直看起来像指针。
我想更改光标样式以显示为等待(即 CSS 样式 wait)。这是我需要更改的示例代码:
function myHandler(button) {
//1. TODO: Change the cursor to wait
processingStuff(); // This might take 10 seconds
//2. TODO: Change the cursor back to the default
};
Ext.application({
name: 'Ext.Array.clean()',
launch: function () {
Ext.create('Ext.Button', {
text : 'My Button',
renderTo: Ext.getBody(),
handler : myHandler
});
} // launch
}); // Ext.application()
更新:
谢谢 hopper 和 Lauren,缺少的一点是我需要一些延迟才能运行 processingStuff() 方法,如下所述:Extjs Load Mask while long processing
这是一个基于 Lauren 小提琴的示例:http://jsfiddle.net/WbMSW/
上面的示例在IE中不起作用,我不知道为什么,我猜按钮上的hover事件没有及时触发,我能想到的唯一解决方案是使用掩码或使用@987654329 @正如劳伦建议的那样:http://jsfiddle.net/G9tqx/6/(我不能使用网络工作者,因为它们在 IE8 中不受支持)
【问题讨论】:
标签: javascript css extjs extjs4