PDA

View Full Version : autoExpandColumn isn't autoExpanding



epalm
27 Apr 2010, 8:15 AM
I think I'm following the docs correctly. All the columns are the same width (see attached screenshot), though I'm trying to get the "title" column to be as big as its content (which is I think what autoExpandColumn is for).

What am I missing?



Ext.ns('EAA.custom');

EAA.custom.DocumentGrid = Ext.extend(Ext.Panel, {

constructor: function(config) {

config = config || {};

var store = new Ext.data.Store({
autoLoad: true,
url: 'documents/listDocuments.html',
baseParams: {
start: 0,
limit: 50
},
reader: new Ext.data.JsonReader({
root: 'data',
totalProperty: 'count'
}, ['id', 'commonId', 'title', 'isbn'])
});

Ext.apply(config, {
layout: 'fit',
height: 400,
frame: true,
title: "Documents",
items: {
xtype: 'grid',
autoExpandColumn: 'title',
enableColumnHide: false,
store: store,
columns: [
{ header: 'DocID', dataIndex: 'id' },
{ header: 'CommonID', dataIndex: 'commonId' },
{ header: 'Title', dataIndex: 'title', id: 'title' },
{ header: 'ISBN', dataIndex: 'isbn' }
],
bbar: new Ext.PagingToolbar({
pageSize: 50,
store: store
})
}
});

EAA.custom.DocumentGrid.superclass.constructor.call(this, config);
}

});

Ext.reg('DocumentGrid', EAA.custom.DocumentGrid);




var documentGrid = new EAA.custom.DocumentGrid({
id: 'documentGrid',
renderTo: 'div_documentGrid'
});

<div id="div_documentGrid"></div>

Nesta
27 Apr 2010, 10:02 AM
the first that hasn't set forcefit:true :)
the autoexpandcolumn options needs a id to be defined at
the column you want to expand

epalm
27 Apr 2010, 10:06 AM
the first that hasn't set forcefit:true :)
I'll try setting that option to true.


the autoexpandcolumn options needs a id to be defined at the column you want to expand
That's what I'm doing here, no?

{ header: 'Title', dataIndex: 'title', id: 'title' }

Nesta
27 Apr 2010, 10:21 AM
right id:'title' will fix your problem.

don't set forceFit to true! this will disable the autoexpand option

epalm
27 Apr 2010, 10:24 AM
I don't think you understand.

If you look at my original post, id: 'title' is already there.

And forceFit defaults to false. I'm not setting forceFit anywhere, so it's already false.

Nesta
27 Apr 2010, 10:27 AM
sry haven't seen the id property.