我已经定义了一个新的类"ConfirmationPanel“,并且我想在窗口中创建这个面板。当我第一次创建窗口时,它显示得很好。但是当我创建第二个窗口时,window-1中的面板移动到了window-2。我想为每个窗口创建两次相同的面板。我该怎么做呢?
Ext.define('MyApp.views.ConfirmationPanel', {
extend: 'Ext.grid.Panel',
requires: 'MyApp.store.ConfirmationStore',
border: false,
initComponent: function() {
this.store = Ext.create('MyApp.store.ConfirmationStore', {});
this.columns = this.buildColumns();
this.callParent(arguments);
},
buildColumns: function() {
return [
{text: "Id", width: 50, flex: 1, dataIndex: 'docId', sortable: true},
{text: "Name", width: 150, dataIndex: 'docName', sortable: true},
{text: "Type", width: 75, dataIndex: 'docType', sortable: true},
{text: "URL", width: 115, dataIndex: 'docUrl', sortable: true},
{text: "Sent Time", width: 115, dataIndex: 'docSentTime', sortable: true},
{text: "Ack Time", width: 115, dataIndex: 'docAckTime', sortable: true}
];
},
viewConfig: {
listeners: {
itemdblclick: function( dataview, record, item, index, e) {
alert( 'opening document here');
}
}
}
});
如有任何帮助/建议,我们不胜感激。
-我尝试在tabpanel中创建新的panel实例,如下所示。但即便如此,它也只创建了一个实例。也许我做的事情基本上是错的。
items: {
xtype:'tabpanel',
plain:true,
activeTab: 0,
height:350,
defaults:{
bodyPadding: 10
},
items: [
{
title:'Test',
items: Ext.create('Ext.panel.Panel', {
bodyPadding: 5,
title: 'Filters',
items: [{
xtype: 'datefield',
fieldLabel: 'Start date'
}, {
xtype: 'datefield',
fieldLabel: 'End date'
}]
})
},
{
title:'My Confirms',
items: Ext.create( "MyApp.views.ConfirmationPanel")
}
]
}发布于 2011-11-29 14:19:12
试一试
Ext.define('MyApp.views.ConfirmationPanel', {
...
alias: 'confirmpanel',
...在选项卡面板中:
{
title:'My Confirms',
items: [{
xtype: 'confirmpanel'
}]
}出现这种行为的原因是因为在设置过程中通过Ext.create( " MyApp.views.ConfirmationPanel ")创建了MyApp.views.ConfirmationPanel的唯一一个实例
https://stackoverflow.com/questions/8252769
复制相似问题