PDA

View Full Version : problem with ColumnModel.setConfig



aj3423
13 May 2009, 7:15 PM
grid.getColumnModel().setConfig(config);

thie config is an array:
[{header:xx, dataIndex:xx, id:xx, sortable:true, width:80}, {...} ... {...}]

there is an error when I click the header, and another error when click the 'Sort Ascending' or 'Sort Decending', what is missed for the config?

the config and error message can be seen in firebug:
Thsnks.

Condor
13 May 2009, 10:54 PM
You probably specified a dataIndex that isn't in the store.

ps. If you change both the store and the columns you need to call grid.reconfigure instead.

aj3423
13 May 2009, 11:55 PM
I tried grid.reconfigure like this:


grid.getColumnModel().setConfig(config);
grid.reconfigure(grid.store, grid.getColumnModel());
but still has the problem..
how to dynamically change the column..

aj3423
14 May 2009, 12:49 AM
I tried your plugin for ext2 at :
http://extjs.com/forum/showthread.php?t=53009

and get this error,
this.recordType is undefined

this.recordType.prototype.fields.replace(field);

Condor
14 May 2009, 12:00 PM
1. You don't need to call setConfig if you already call reconfigure (reconfigure calls setConfig).
2. I think you created your store incorrectly. You need to create it with a reader with at least one field.

aj3423
14 May 2009, 6:55 PM
Oh it is the problem, after adding a fields property, everything is ok.
Thanks again Condor!

myReader = new Ext.data.JsonReader({
fields: ['xx'],
root : 'ddd',
totalProperty : 'totalCount'
});