ExtJS 4.1: How to adjust column width for content in a grid?

I have a column to display db ids, and I would like this column to automatically adjust its width to the longest. I found a configuration option shrinkWrap, but I do not see any results on the screen.

+5
source share
2 answers

There is a private function expandToFitthat can be used for a mesh header container object.

Try something similar in the object Ext.grid.column.Columnafter all the records are loaded into the grid, for example, in the event viewReady Ext.grid.Panel:

column.ownerCt.expandToFit(column);

Go through the columns and call the above statement for each column that you want to expand.

+1
source

flex :

{
   text:"Ids",
   dataIndex:'Ids',
   flex:1
}
-3

All Articles