PDA

View Full Version : grid panel fit verticaly in panel



santoshsatav
26 May 2010, 2:21 AM
i have viewport with layout border having center region,
i added grid panel in center region,
center region having layout column,
i want to fit grid vertically automatically to size of center region without giving height attribute how it can be done?

thanks in advance !:-/

Condor
26 May 2010, 6:04 AM
A column layout can't do that. For that you need a hbox layout (configured with align:'stetch').

santoshsatav
26 May 2010, 9:08 PM
hbox layout to panel and align stetch not working thanks for response

Condor
26 May 2010, 11:35 PM
Can you post an example (I assume you misconfigured your layout somewhere)?

santoshsatav
27 May 2010, 12:18 AM
i am not able paste example sorry for that ,but can you paste example where viewport has panel with border layout and in center region having hbox layout said by you has 2 grid panels both with flex 1 and both should stretch itself to fit center region without specifying height confg., grids having autoscroll enabled,both grid should fit themselves in center region as an when window re-sized
and thanks for reply

Condor
27 May 2010, 12:24 AM
new Ext.Viewport({
layout: 'border',
items: [{
region: 'north',
height: 100,
title: 'North',
},{
region: 'south',
height: 100,
title: 'South',
},{
region: 'east',
width: 100,
title: 'East',
},{
region: 'west',
width: 100,
title: 'West',
},{
region: 'center',
xtype: 'container',
layout: {
type: 'hbox',
align: 'stretch'
},
items: [{
flex: 1,
xtype: 'grid',
store: [1, 2, 3, 4, 5],
columns: [{header: 'Number', dataIndex: 'field1'}]
},{
flex: 1,
xtype: 'grid',
store: ['One', 'Two', 'Three', 'Four', 'Five'],
columns: [{header: 'Text', dataIndex: 'field1'}]
}]
}]
});

santoshsatav
27 May 2010, 12:58 AM
excelent i am trying it from 2 days thanks very helpfull ,but what another problem is i want to keep some distance between both grids before i used

style: {marginRight: '5px' },

to keep space between them , what replace ment i can use for hbox?
thanks once again

Condor
27 May 2010, 1:46 AM
HBoxLayout supports a 'margins' config option in its items.

santoshsatav
27 May 2010, 9:01 PM
thanks everything working fine thanks again