{
xtype : 'button',
text : 'Prikazi',
handler : function(item,el){
this.setDisabled(true);
store.load(function(records, operation, success) {
if(success){ this.up('button').setDisabled(false); }
});
}
}
问题: this.up('button')
答案 0 :(得分:1)
只需使用您传递的参数 -
因为'this'首先指向按钮,而在回调中它指的是商店:
{
xtype: 'button',
text: 'Refresh',
id: 'btn_refresh',
handler: function(clicked_button, the_event) {
clicked_button.setDisabled(true);
store.load(function(records, operation, success) {
if(success){
clicked_button.setDisabled(false);
}
});
}
}
使用商店的beforeload事件来控制按钮状态可能会更优雅。
更新:更改变量名称以使示例更加明显。
也许结帐FireBug或Chrome Developer Tools一次
...请接受答案,以防它应该有用。