绑定Extjs中的面板

时间:2015-03-09 14:53:15

标签: extjs4

你好我有两个面板西和中心。中心是网格和西方我想从网格中放入一些数据。我如何从中心面板获取西部帕内特属性? 我试过这个:
var westPanel= Ext.getCmp('WestPanelId',{ html: Hello world }); 这是西部小组:

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

感谢。

1 个答案:

答案 0 :(得分:0)

这应该可以解决问题:

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