PDA

View Full Version : crash when resize grid



malcom
29 Jun 2007, 2:07 AM
hi all,

Can you help ?
I have a function list_show_data2(pb_init) like below,
When I call with list_show_data2(true), I can resize the grid object normally.
But if I call with list_show_data2(false) and resize this grid object, system will crash at line 27731 of ext-all-debug.js file with error msg of "Microsoft JScript run error: 'this.cm' is null or is not a object."

many thanks.
ps. please see attached image for g_list grid object


//=================
function list_show_data2(pb_init){

//reset grid control if need
var pa_data;
if (pb_init){
pa_data = null;
}else{
pa_data = [
['t1','name 1','001'],
['t2','name 2','002'],
['t3','name 3','003']
];

g_list.destroy();
}


//set column define
var ta_cm = [
{id:"f1", header:"f1 header", width:60, sortable:true, dataIndex:"f1"},
{id:"f2", header:"f2 header", width:60, sortable:true, dataIndex:"f2"},
{id:"f3", header:"f3 header", width:60, sortable:true, dataIndex:"f3"}
];

var ta_cm2 = [
{name:"f1", type:"string"},
{name:"f2", type:"string"},
{name:"f3", type:"string"}
];


//set columnModel
var t_cm = new Ext.grid.ColumnModel(ta_cm);


//set data store and load it
var t_ds = new Ext.data.Store(
{
proxy: new Ext.data.MemoryProxy(pa_data),
reader: new Ext.data.ArrayReader({}, ta_cm2)
}
);
t_ds.load();


//create grid control
g_list = new Ext.grid.Grid("data_list", {
ds: t_ds,
cm: t_cm
});


g_list.render();
}
//=================

malcom
2 Jul 2007, 1:34 AM
hi all,
It's fixed now, I used grid.dataSource.removeAll() instead of destroy grid, and it did not crash any more.
Thanks.