PDA

View Full Version : borderlayout and grid autoSzie



gem
5 Jul 2007, 12:27 AM
Hi,Jack,
I split a window like this:


UI.Layout.layout = new Ext.BorderLayout(document.body, {
north: {
split : false,
initialSize : 46,
titlebar : false
},
west: {
split : true,
initialSize : 300,
minSize : 100,
titlebar : true,
collapsible : true,
animate : true
},
center: {
titlebar : true
},
south: {
split : false,
initialSize : 23,
titlebar : false,
collapsible : true
}
});

UI.Layout.layoutWest = new Ext.BorderLayout('west-div', {
center: {
initialSize : 300,
minSize : 100,
autoScroll : true,
collapsible : true,
animate : true,
titlebar : true
},
south: {
split : true,
initialSize : 300,
minSize : 100,
autoScroll : true,
collapsible : true,
titlebar : true,
animate : true
}
});

I put my grid ( named UI.Usergrid bellow) into a div named 'container-div' as the grid container , and put the container into the center of UI.Layout.layoutWest which is a div named 'west-center-div'.
If I change the container to be smaller or bigger by dragging the handle of UI.Layout.layoutWest or UI.Layout.layout, how can I get the grid to resize itself automatically ?
It doesn't work ,when I use the code bellow.
but if I resize the brower window, the grid will resize to fullfill the 'west-center-div' ,which is I need


UI.Usergrid = new Ext.grid.Grid('container-div',
{
ds: ds,
cm: colModel,
enableColLock: false,
autoSizeHeaders: true,
autoSizeColumns: true
});

var panel = new Ext.GridPanel('container-div',
{
fitToFrame:true,
fitContainer:true,
autoScroll:true
}
);



var layout = Ext.BorderLayout.create({
center: {
margins: {left:3,top:3,right:3,bottom:3},
panels: [panel]
}
}, 'west-center-div');

var rz = new Ext.Resizable('container-div', {
wrap:true,
minHeight:100,
pinned:true
});
rz.on('resize', UI.Usergrid.autoSize, UI.Usergrid);

why? thanks!

it seems that when I drag the handles ,only the 'west-center-div' is resized ,but the 'container-div' is changeless .

tryanDLS
5 Jul 2007, 7:15 AM
Please post your code in CODE tags.

Put your grid in a GridPanel rather than ContentPanel - it will handle resizing. This has been covered many times.