javascript - How to access parent component ExtJS? -


for reason, blur event doesn't fired when below floating panel loses focus. however, when listen 'el' of panel blur event, gets registered shown in listeners config. want hide panel when blur event occurs. how access parent panel ?

ext.define('notekeeper.view.tabs.attachmentpanel',{     extend : 'ext.panel.panel',     alias : 'widget.attachmentpanel',     itemid : 'attachmentpanel',     floating : true,     focusable : true,     width : 200,     height : 150,     layout : {         type : 'vbox'     },     items : [         {             xtype : 'grid',             store : null,             columns : [                 {                     text : 'file name',                     dataindex : 'filename'                 },                 {                     dataindex : 'remove'                 }             ]         },         {             xtype : 'button',             text : '+'         }     ],     listeners : {         el: {             blur: {                 fn: function()                 {                     console.log( );                     //how access 'attachmentpanel' here                      //so can hide ?                 }             }         }     },     noteid : null,     initcomponent : function()     {         this.callparent(arguments);     } }); 

please note there can multiple instances of these 'attachmentpanel's.

the following appears work fine:

listeners : {         el: {             blur: {                 fn: function()                 {                     console.log(this);                     var elid = this.id;                     var attachmentpanels = ext.componentquery.query('#attachmentpanel');                     ext.array.foreach( attachmentpanels, function(cmp){                         if(cmp.id == elid)                         {                             cmp.hide();                             return false;                         }                     });                 }             }         } 

please let me know if there better/more efficient solution. thanks!


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -