extjs4.2访问不同tabs的值

Access the values of different tabs in extjs4.2

我在 extjs4.2 中创建了一个选项卡面板,我想做的是在另一个选项卡中访问选项卡形式的值。例如,用户在选项卡 A 上可以访问选项卡 B 中的值。如何访问其他选项卡?

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]
    });

在这部分,我可以通过单击按钮访问当前帧。

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();*/



        }

到selectExt.ComponentView you can use Ext.ComponentQuery

Provides searching of Components within Ext.ComponentManager (globally) or a specific Ext.container.Container on the document with a similar syntax to a CSS selector. Returns Array of matching Components, or empty Array.

有关 select 或 DOM 元素和 ExtJS 组件的更多信息 this answer

如何访问 tabpanel 的另一个选项卡的基本示例:

Working fiddle

// If you button is child / parent button of a tabpanel its efficient to use down() / up() methods
// Since we get button component reference as listener function arguments we can select parent tabpanel component,
// and after it select child component panel (because panel is default xtype for tabpanel items and textfield after it
panelBTextFieldValue = button.up('tabpanel').down('panel[id=panel_B] textfield[name=panel_B_text_field]').getValue();

// If your button is somewhere else you can use Ext.ComponentQuery.query()
panelBTextFieldValue = Ext.ComponentQuery.query('tabpanel[id=myPanel] panel[id=panel_B] textfield[name=panel_B_text_field]').getValue();

// or just if selector textfield[name=panel_B_text_field] specific enought for whole your application
panelBTextFieldValue = Ext.ComponentQuery.query('textfield[name=panel_B_text_field]').getValue();