Ext.getCmp()的简单使用

Ext.getCmp(Ext组件ID),根据Ext组件的ID选择EXT组件。

例如:点击Panel->toolbar上的button改变Panel的标题

Ext.onReady(function(){
    Ext.create('Ext.panel.Panel', {
        id: 'myPanel',
        title: 'Ext Panel',
        renderTo: Ext.getBody(),
         300,
        height: 200,
        dockedItems: [
            {
                xtype: 'toolbar',
                dock: 'top',
                items: [
                    {
                        text: 'click me',
                        handler: function(){
                            Ext.getCmp('myPanel').setTitle('Change Panel Title');
                        }
                    }
                ]
            }
        ]
    });
});
原文地址:https://www.cnblogs.com/yshyee/p/3697982.html