Automatically resize grid when resizing window

I am using the ext3s grid-grid example to try to set the grid in the container window. The problem is resizing the container window; the grid will not automatically fit the new size. As far as I understand, it should work.

Here's a link to an example: http://www.extjs.com/deploy/dev/examples/grid/array-grid.html

I have done the following:

// Added to gridpanel config layout: 'fit', viewConfig: { forceFit: true } // Window container var gridWindow = new Ext.Window({ items: [ grid ] }); // Instead of grid.render, use gridWindow.show(); gridWindow.show(); 

result

+7
extjs
source share
4 answers
 layout: 'fit', 

must go into gridWindow configuration! The layout manager arranges for the children of the panel, but the grid is .

+9
source share

I am using the following workaround:

 Ext.onReady(function () { var grid = ... //define your grid here Ext.EventManager.onWindowResize(function () { grid.setSize(undefined, undefined); }); }); 

Extjs v4.0.7

+9
source share

I solved this by wrapping my gridpanel in Ext.Panel, with the layout property set to "fit". Grid panel (with viewConfig, also containing forceFit: "true" now changes automatically when the window is resized

+1
source share

I think you need to use the EventManager class. Please read it on the next blog.

0
source share

All Articles