0
我有一個在頂部工具欄內有一個文本字段的樹面板。後擊鍵樹重新加載,但它偷焦點遠離文本當樹加載它是偷竊焦點
這裏是我的代碼:
Ext.define('search_tree', {
extend:'Ext.tree.Panel',
rootVisible:false,
autoScroll:true,
store:Ext.create('Ext.data.TreeStore', {
root:{
id:'node',
nodeType:'async'
},
proxy:{
actionMethods:{
'read':'POST'
},
type:'ajax',
url:'myurl'
}
}),
tbar:['Search:', {
xtype:'textfield',
id:'search_combo',
listeners:{
keyup:{buffer:150,fn:function(field, e) {
var val = this.getRawValue();
if(val.length != this.valueLength){
var thisTree = this.up('treepanel');
thisTree.store.getRootNode().removeAll();
//***************
//When this load finishes the focus is taken away
//From the text field :(
//***************
thisTree.store.load({params:{search_string:val}});
}
}}
}
}]
});
此解決方案的工作原理除了大約一秒鐘的時間失去焦點,幾乎無法準確輸入完整的工作:(感謝您的答案,儘管 – neolaser 2011-05-12 23:21:04