PDA

View Full Version : set Maximum and minimum height for grid panel



alok000707
11 Mar 2011, 3:12 AM
Hi,

Can we set minimum and maximum height to a grid panel, so that the grid panel restricts to minimum height when there is less data or no data and also restrict it to max height when there is lot of data.

Please let me know.

Thanks in advance
ALok

walldorff
11 Mar 2011, 2:35 PM
GridPanel has a maxHeight config property. Or maybe you can set height to a fixed minimum and call setHeight after store load.


var store = new Ext.data.JsonStore({...});
var grid = new Ext.grid.GridPanel({...});
store.on('load', function(_store, _records) {
var _height;
// do your calculation here, based on the amount of records
grid.setHeight(_height);
})

alok000707
12 Mar 2011, 3:14 AM
maxHeight is not working,

Later option is good, but I dont want to do that.

Is there any other option?

walldorff
12 Mar 2011, 3:24 AM
maxHeight is not working

maxHeight is ignored if autoHeight is not on.

alok000707
12 Mar 2011, 3:38 AM
Thanks for your quick response.

But its not working :(

I have given the following in code:
autoHeight:true,
maxHeight:300,

but its expand according to data.

walldorff
12 Mar 2011, 3:51 AM
Use the override from Aaron Conran (http://www.sencha.com/forum/showthread.php?31093-GridPanel-maxHeight&p=146422&viewfull=1#post146422).
This may do the trick.