javascript - Access the values of different tabs in extjs4.2 -


i have created tab panel in extjs4.2 , , i'm trying access values in form of tab while being in other tab. example user on tab , have access values in tab b. how can access other tab?

tabpanel = ext.create('ext.tab.panel', {         region: 'center',         activetab: 0,         autoscroll: true,         items: [                 {                        id:"panel_a",                     title: "${tr.a}",                     html: "<iframe src= '"+a_url +"' width='100%' height='100%' id='frm_a' name='frm_a' frameborder=0 />",                 },{                     id:"panel_b",                     title: "${tr.b}",                     //disabled:tabs_status,                     //hidden:hidden,                     html: "<iframe src='"+b_url +"'  width='100%' height='100%' id='frm_b' name='frm_b' frameborder=0 />",                 }]         });       viewport = new ext.viewport({         layout:'border',         items:[tabpanel]     }); 

in part on click of button i'm able access current frame.

new ext.toolbar.button({                         id:"btn_show",                         text: "${tr.show}",                         tooltip: "${tr.show}",                         handler: function(){view(frmid);}                     }),       function view(frmid) {               var a_key =   window.frames[frmid].record.getkey();             /* var b_key = window.frames[...].record.getfield("history").getrealvalue();*/            } 

to select ext.componentview can use ext.componentquery.

provides searching of components within ext.componentmanager (globally) or specific ext.container.container on document similar syntax css selector. returns array of matching components, or empty array.

more selectors dom elements , extjs components in this answer.

basic example of how can access tab of tabpanel:

working fiddle

// if button child / parent button of tabpanel efficient use down() / up() methods // since button component reference listener function arguments can select parent tabpanel component, // , after select child component panel (because panel default xtype tabpanel items , textfield after panelbtextfieldvalue = button.up('tabpanel').down('panel[id=panel_b] textfield[name=panel_b_text_field]').getvalue();  // if button somewhere else can use ext.componentquery.query() panelbtextfieldvalue = ext.componentquery.query('tabpanel[id=mypanel] panel[id=panel_b] textfield[name=panel_b_text_field]').getvalue();  // or if selector textfield[name=panel_b_text_field] specific enought whole application panelbtextfieldvalue = ext.componentquery.query('textfield[name=panel_b_text_field]').getvalue(); 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -