PDA

View Full Version : Gridpanel autoscale vertical



xonixx
13 Sep 2010, 12:42 PM
Hi,

my problem is that i have 3 different datastores. So the idea is to generate for every store a gridpanel and and this three gridpanels into an panel that it looks like one gridpanel and hide the panels if not needed. So i need no filtering ;)

Now im not sure if its possible to change the height if add a new row, the gridpanel should autoscale vertical. i tryed it with heightAuto, but nothing happen. Any solutions to add 3 gridpanels vertical which auto scale or group 3 stores into one gridpanel ?

Regards,

Xonixx

darthwes
13 Sep 2010, 2:29 PM
You have to pick a layout manager. You have to understand (at least one) layout(s). This is the cost of using Ext.

Pick one (that isn't static), and hide/show your grids, and then tell the layout manager to re-lay-out. This is done with the method doLayout.

I'd suggest vbox. And watch out for grid.hide/show with [v|h]box, you'll have to set your grid's flex attribute (to 0 to hide) before invoking grid.ownerCt.doLayout (or some version thereof).

xonixx
13 Sep 2010, 11:39 PM
Thanks for youre fast answer.

22389

For testing i have set the mainpanel which is in the picture black to height 500 and set them as a vbox layout, now i added the two gridpanels inside it, and added many rows to both gridpanels, but only 1 row per gridpanel is displayed. The gridpanels doesn't autoscale the height ;(



panel1 = new Ext.grid.GridPanel({
autowidth: true,
region: "center",
border: false,
hideHeaders: true,
store: panel1store,
columns: [{
autoWidth: true,
dataIndex: "Name"
}],
sm: new GeoExt.grid.FeatureSelectionModel()
});


panel2 = new Ext.grid.GridPanel({
autowidth: true,
region: "center",
border: false,
hideHeaders: true,
store: panel2store,
columns: [{
autoWidth: true,
dataIndex: "Name"
}],
sm: new GeoExt.grid.FeatureSelectionModel()
});

mainpanel = new Ext.Panel({
title: gt.gettext("MainPanel"),
layout:'vbox',
layoutConfig: {
align: 'stretch',
pack: 'start'
},
height: 500,
tbar: toolbarTop,
bbar: toolbarButtom,
items: [panel1,
panel2]
});

Condor
13 Sep 2010, 11:58 PM
1. autowidth:true does nothing (the config option is called autoWidth and you do NOT want to use it here).
2. Configure your gridpanels with autoHeight:true.
3. Instead of a vbox layout use anchor layout:

layout: 'anchor',
defaults: {anchor: '100%'}