!我正在尝试重新配置网格。它运行正常,但当我点击客户,然后它显示错误。如果我使用xtemplate覆盖它,请告诉我如何重新配置网格。
var data1 = [
['1','Sanjay'],
['2','Vinod']
];
var customersStore = new Ext.data.ArrayStore({
fields: ['id', 'cust_name'],
data: data1
});
var customersColumnModel = new Ext.grid.ColumnModel([
{ header: "ID", width: 40, dataIndex: 'id' },
{ header: "Cust Name", width: 130, dataIndex: 'cust_name' },
]);
var data2 = [
[1,'border',],
[2,'hobit',],
];
var moviesStore = new Ext.data.ArrayStore({
fields: ['id', 'title'],
data: data2
});
var moviesColumnModel = new Ext.grid.ColumnModel([
{ header: "ID", width: 130, renderer:id, dataIndex: 'id'},
// { header: "Title", width: 130, dataIndex: 'title'}
]);
Ext.onReady(function() {
var new_grid = new Ext.grid.GridPanel({
title: 'Customers',
id:'detailPanel',
store: customersStore,
cm: customersColumnModel,
renderTo: Ext.getBody(),
width: 750,
height: 500,
tbar: {
items: [
{
text: 'Customers',
handler: function()
{
new_grid.setTitle('Customers');
new_grid.reconfigure(customersStore,customersColumnModel);
customersStore.load();
}
},
'-',
{
text: 'Movies',
handler: function()
{
new_grid.setTitle('Movies');
var detailPanel = Ext.getCmp('detailPanel');
tpl.overwrite(detailPanel.body);
}
}
]
},
});
var tpl = new Ext.XTemplate('hello');
如果我使用xtemplate覆盖它,请告诉我如何重新配置网格。