我用预先配置的Column Model和仓库界定了GridPanel,并将这一GridPanel置于Ext.Window中;然而,如果我关闭并再次显示,GridPanel的Column Model倒台,那么该GridPanel无法正确提供。
www.un.org/Depts/DGACM/index_french.htm
var stSummary = new Ext.data.JsonStore({ //define the store for Summary_Grid
fields : [
{
name: recID
}, {
name : name ,
}],
data: []
});
var colModelSummary = { //define the ColumnModel for Summary_Grid
columns:
[
{
header : "ID",
width : 50,
sortable : true,
menuDisabled: true,
dataIndex : recID
},
{
header : "Name",
width : 100,
sortable : true,
menuDisabled: true,
dataIndex : name
}
]
};
var reportConfig = {
id : Report_Window ,
width : 250,
floating : true,
style : {
opacity : 0.7,
},
title : "Report",
layout: fit ,
items : [{
xtype: tabpanel ,
id: Report_Tab ,
height: 200,
activeTab: 1,
items:
[
{
xtype : grid ,
store : stSummary,
colModel : new Ext.grid.ColumnModel(colModelSummary),
stripeRows : true,
id : "Summary_Grid",
title : "Summary at",
sm : new Ext.grid.RowSelectionModel({
singleSelect : true
}),
listeners: {
beforerender : function() {
console.log(this.getColumnModel().getColumnCount());
}
}
},
{
xtype : form ,
id : Report_Form ,
title: Item Report ,
frame : true,
labelAlign : left ,
bodyStyle : padding:2px ,
autoScroll: true,
layout : column ,
items : []
}
]
}],
resizable : {
dynamic : true
}
};
var reportWindow = new Ext.Window(reportConfig);
reportWindow.show();
document.onclick = myClickHandler;
function myClickHandler() {
if(!Ext.getCmp( Report_Window )) {
var reportWindow = new Ext.Window(reportConfig);
}
Ext.getCmp( Report_Window ).show();
}
});
和错误:
Uncaught TypeError: Cannot read property length of undefined
Ext.grid.ColumnModel.Ext.extend.getColumnCount ext-all.js:11