javascript - When a tree loads it is stealing focus -


i have tree panel text field within top toolbar. after keystrokes tree reloaded, stealing focus away textbox

here code:

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 load finishes focus taken away                         //from text field  :(                         //***************                          thistree.store.load({params:{search_string:val}});                                                                         }                                                }}             }             }] }); 

one solution add callback params on store.load() call focus on text:

//*************** //when load finishes focus taken away //from text field  :( //***************  thistree.store.load({params:{     search_string:val,     callback: function() {         this.focus(); /*or ext.getcmp('search_combo').focus() depending on scoping*/     } }});                                                     

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -