View Full Version : Should grid.reconfigure autoSizeColumns? hide/show autoSize?

28 Mar 2007, 5:55 AM
I have autoSizeColumns set when I initially render the grid. This works fine.

It doesn't autoSize the columns when doing grid.reconfigure with a new columnModel.

Is there any way to make this happen other than re-rendering the grid and re-attaching the toolbars?

Is there any way to autoSizeColumns when hiding or showing columns? I don't ever want to have scrollbars on my grid.

28 Mar 2007, 6:20 AM
grid.reconfigure calls this.view.refresh(true). GridView.refresh is declared as:

refresh : function(headersToo)

which calls layout() on the view without any parameters. The function declaration is:

layout : function(initialRender)

When called without any parameters, initialRender will not be true, which causes some recursive activity to occur that makes some of the grid sizing magic work.

You may be able to call grid.getView().autoSizeColumns() directly to handle this, but who knows? It's all development anyway, so it's worth a shot. :)

28 Mar 2007, 6:57 AM
Teriffic!!! That works perfectly.

So an answer to my second question is:

To make the columns autosize when columns are hidden or unhidden use this:

cm.on('hiddenchange', function() {