Extjs4 在Extjs中绑定面板

Extjs4 在Extjs中绑定面板,extjs4,Extjs4,你好,我有两个面板,西面和中间。中心是网格,我想从网格中输入一些数据。如何从中心面板获取西窗格属性? 我试过: var westPanel=Ext.getCmp('WestPanelId'{ 你好,世界 }); 这是西面板: Ext.define('ExtMVC.view.portal.SettingsMenu', { extend: 'Ext.panel.Panel', alias: 'widget.settings', initComponent: fun

你好,我有两个面板,西面和中间。中心是网格,我想从网格中输入一些数据。如何从中心面板获取西窗格属性? 我试过:
var westPanel=Ext.getCmp('WestPanelId'{
你好,世界
});
这是西面板:

Ext.define('ExtMVC.view.portal.SettingsMenu', {
    extend: 'Ext.panel.Panel',    

    alias: 'widget.settings',

    initComponent: function() {

        Ext.apply(this, {

            title:'Settings',
            html: ExtMVC.util.Constants.shortBogusMarkup,
            border: false,
            autoScroll: true,
            iconCls: 'settings'

        });

        this.callParent(arguments);
    }
});

谢谢。

这应该可以做到:

Ext.define('ExtMVC.view.portal.SettingsMenu', {
    extend : 'Ext.panel.Panel',
    alias  : 'widget.settings',
    region : 'west',


    loadData: function(record){
        // Do what you want with the selected record
    }
});

Ext.define('ExtMVC.view.portal.Grid', {
    extend : 'Ext.grid.Panel',
    region : 'center',

    initComponent : function(){
        this.on('itemclick', function(grid, record){
            grid.up()              // Go up the DOM tree to select the grid's parent component
                .down('settings')  // Go down the DOM Tree to select the component with the xtype "settings" (your west panel)
                .loadData(record); // Call the desired function on the component with the clicked record as parameter
        }, this);

        this.callParent(arguments);
    }
});

在西面板中创建一个表单,并收听网格的
itemclick
事件,然后使用
itemclick
事件的
record
参数中接收的数据填充表单。