PDA

View Full Version : [2.0a1][CLOSED] autoExpandColumn throws exception



sfwalter
4 Oct 2007, 4:35 AM
Hi,

When using autoExpandColumn I get this:

this.config[col] has no properties
[Break on this error] return this.config[col].width || this.defaultWidth;

I noticed the array grid demo page has the same issue.

scott.

jack.slocum
4 Oct 2007, 4:51 AM
Can you give any more details? I am not seeing the same issue.

sfwalter
4 Oct 2007, 5:12 AM
Jack,

I accidentally typed a character in the array grid sample page and save it. Ooops, thats why the array grid threw the exception. My bad!!!

However I think I found the issue, I had my "id" and first "dataindex" to be different such as:


{id:'vendorid',header: "Vendor", width: 60, sortable: false, locked:true, dataIndex: 'vendor'}


which causes this exception:
this.config[col] has no properties
[Break on this error] return this.config[col].width || this.defaultWidth;

however if I set the "id" and first "dataindex" to the same then everything is ok. Basically I have a column from my data source that is named "vendorid", but I don't want to display that on my grid.

jack.slocum
4 Oct 2007, 5:15 AM
It sounds like you have your autoExpandColumn pointing to a column id that doesn't exist. Can you post your grid, store and column defs?

sfwalter
4 Oct 2007, 5:24 AM
here is my datastore:



var ds = new Ext.data.Store({
reader: new Ext.data.ArrayReader({}, [
{name: 'vendorid'},
{name: 'vendor', type: 'string'},
{name: 'days', type: 'float'},
{name: 'service', type: 'boolean'},
{name: 'credit', type: 'boolean'},
{name: 'replace', type: 'boolean'},
{name: 'serial', type: 'boolean'}
])
});


and here is my grid and column model:



var grid = new Ext.grid.GridPanel({
el:'guidelines',
ds: GuidelinesUI.getGuidelines(),
cm: new Ext.grid.ColumnModel([
{id:'vendorid',header: "Vendor", width: 60, sortable: false, locked:true, dataIndex: 'vendor'},
{header: "Concealed damaged<br/> must be reported <br/>within # of days", width: 120, sortable: false,locked:true, dataIndex: 'days',align:'center'},
{header: "Send product to <br/>RAC Service for <br/>Repair or RA process", width: 120, sortable: false,locked:true,dataIndex: 'service', renderer: function(value) {return value ? "yes" : ""},align:'center'},
{header: "Vendor will issue<br/>credit/store will<br/>re-order if needed", width: 120, sortable: false,locked:true, dataIndex: 'credit', renderer: function(value) {return value ? "yes" : ""},align:'center'},
{header: "Vendor will ship <br/>replacement<br/> unit or parts", width: 120, sortable: false,locked:true, dataIndex: 'replace', renderer: function(value) {return value ? "yes" : ""},align:'center'},
{header: "Damaged component<br/>serial #<br/>required", width: 120, sortable: false,locked:true, dataIndex: 'serial', renderer: function(value) {return value ? "yes" : ""},align:'center'}
]),
height:350,
autoExpandColumn: 'vendor',
});

jack.slocum
4 Oct 2007, 5:38 AM
You want:

autoExpandColumn: 'vendorid'

There is no column defined with id: 'vendor' ;)

sfwalter
4 Oct 2007, 5:58 AM
ahh ic with this line:



{id:'vendorid',header: "Vendor", width: 60, sortable: false, locked:true, dataIndex: 'vendor'}


I thought the autoExpandColumn would point to the "dataIndex" property, but it needed to point to the "id" property.

Thanks Jack!

dandvd
15 Apr 2008, 1:02 PM
When using autoExpandColumn I get this:

this.config[col] has no properties
[Break on this error] return this.config[col].width || this.defaultWidth;


I encountered the same error and traced the problem to not having a column in the columnModel with 'id' set to the value of autoExpandColumn.

It did take me quite a while to find the cause of this error. Could the grid generate a more specific error message?

Thanks,
Dan
http://automaticallyyours.com/img/U2FsdGVkX1-NQC1Lkfq7ZGXm7R5p5wEK/smiley.gif