extjs - Cannot get the object of a tabpanel -
i have grid in center part of border layout. when specific item clicked in grid, need alter center part display tab panel. having problem getting tabpanel object.
in ctrlpanel file, on grid listener, using componentquery tabpanel('ccmain') object. returns undefined.
i using componentquery 'ccmain' in centerpanel file(lays out center region) successfully, when moved code ctrlpanel file(one of items in centerpanel) fails. componentquery no longer returns tabpanel 'ccmain'. componentquery homecoming centerpanel or viewport. attemped centerpanel or viewport.down find 'ccmain', returns undefined. if can tell me how tabpanel or doing wrong, appreciate it. time.
ctrlpanel.js
ext.define('servcsol.view.ctrlpanel',{ extend: 'ext.panel', alias: 'widget.ctrlpanel', xtype: 'ctrlpanel', itemid: 'ctrlpanel', requires:[ 'servcsol.store.facilitystore' ], initcomponent: function () { var me = this; ext.applyif(me, { items: [ { xtype: 'panel', height: 750, title: 'control panel', items: [ { xtype: 'gridpanel', padding: '20 20 5 20', store: 'workhistorystore', height: 590, width: '100%', border: true, columns: [ { width: 110, dataindex: 'wrkhistdate', text: 'due date' }, { width: 100, dataindex: 'wrktype', text: 'work type' } ], listeners : { itemclick: function(dv, record, item, index, e) { if(record.get('wrktype') == 'test') { var tabpanel = ext.componentquery.query('ccmain')[0]; console.log('tabpanel is: ', tabpanel); var tabindex = tabpanel.items.findindex('id', 'hazard'); var center = ext.componentquery.query('centerpanel')[0]; center.getlayout().setactivetab(tabindex); }
ccmain.js
ext.define('servcsol.view.ccmain', { extend: 'ext.tab.panel', itemid: 'ccmain', alias: 'widget.ccmain', xtype: 'ccmain', initcomponent: function () { var me = this; ext.applyif(me, { items: [ { xtype: 'facility' }, { xtype: 'hazlisting' }, { xtype: 'hazard' }, { xtype: 'testformrp' }, { xtype: 'testformdc' } ] }); this.callparent(arguments); } });
one of reasons can ccmain
not instantiated instantiated components can found componentquery.query
. then, if ccmain
found cannot set active item way. easiest assign tabs itemids
, phone call setactivetab:
tabpanel.setactivetab(itemidofthetab)
extjs extjs4
No comments:
Post a Comment