ExtJs组件扩展问题

时间:2013-10-17 07:46:37

标签: javascript extjs

我扩展了Ext.form.FormPanel。它包含带有按钮的first panel和通过按钮点击呈现的second panel。就像图片一样:

enter image description here

但是second panel's项目的变量我在创建这样的时候给了我扩展的FormPanel:

var store = new Ext.data.JsonStore({...});]
sote.load({params:{....}});

var grid = new Ext.grid.GridPanel({
//**config**//
store:store
}); 

var usersPanel = new myapp.StandartForm({
//**some config**//
secondPanelItems:[grid,{field1},{filed2...}]

});

因此,当我创建扩展的FormPanel时,grid只创建了一次。每当第二个面板显示时,我怎样才能创建它?

1 个答案:

答案 0 :(得分:1)

使用xtype。因此每次实例化时都会创建网格(编辑:将商店添加为xtype)

var usersPanel = new myapp.StandartForm({
    //**some config**//
    secondPanelItems:[{
        xtype: 'grid',
        //**grid config**//
        store: {
            xtype: 'jsonstore',
            autoLoad: true,
            // other store attr
            baseParams: {...}
        }
    },{field1},{filed2...}]
});