我有一个问题,我正在创建的网格在幻灯片动画期间而不是之后显示。因此,我决定在创建gridview之前使用计时器等待1秒。我该怎么做呢? setTimeout没有达到我的预期......
答案 0 :(得分:5)
var task = new Ext.util.DelayedTask(function(){
alert(Ext.getDom('myInputField').value.length);
});
// Wait 500ms before calling our function. If the user presses another key
// during that 500ms, it will be cancelled and we'll wait another 500ms.
Ext.get('myInputField').on('keypress', function(){
task.delay(500);
});