eseguin3
13 Jul 2007, 5:54 AM
Hi. I have a border layout that consists of a large center area, and then a nested layout to the north, that also has a north and center region. My problem is this: I'm trying to make it so that on the click of a button, the north-center region(/the center region in the northern nested layout) will hide and the rest of the layout will resize itself accordingly.
Right now, my code is:
var layout = new Ext.BorderLayout(Ext.get('container'), {
north: {
split:true,
collapsible: true,
},
center: {
autoScroll: false,
}
});
var headerLayout = new Ext.BorderLayout(Ext.get('header'), {
north: {
collapsible: false
},
center: {
collapsible: true,
autoScroll: false
}
});
layout.beginUpdate();
headerLayout.add('north', new Ext.ContentPanel('divA',
{fitToFrame:false, closable:false}));
headerLayout.add('center', new Ext.ContentPanel('divB',
{fitToFrame:true, closable:false}));
layout.add('north', new Ext.NestedLayoutPanel(headerLayout));
layout.add('center', new Ext.ContentPanel('centerBody',
{fitToFrame:false, closable:false}));
layout.endUpdate();
//--------Events-----------
var toggleDivB= function() {
// This is being called correctly.
headerLayout.getRegion('center').collapse(true);
}
When I click the button with this, the region collapses, but there is a big blue empty space where it used to be and the other layouts don't resize. I've tried a number of different combinations of using collapse(), hide(), display:none, visibility:hidden/collapsed, but nothing seems to be working right.
I've been pretty successful in hiding the information I want to hide, but I've had no luck at all with resizing layouts. I know that regions have a resizeTo() function, but I would need to be able to find out the current height of the regions before hiding them to use that correctly. Any ideas?
Right now, my code is:
var layout = new Ext.BorderLayout(Ext.get('container'), {
north: {
split:true,
collapsible: true,
},
center: {
autoScroll: false,
}
});
var headerLayout = new Ext.BorderLayout(Ext.get('header'), {
north: {
collapsible: false
},
center: {
collapsible: true,
autoScroll: false
}
});
layout.beginUpdate();
headerLayout.add('north', new Ext.ContentPanel('divA',
{fitToFrame:false, closable:false}));
headerLayout.add('center', new Ext.ContentPanel('divB',
{fitToFrame:true, closable:false}));
layout.add('north', new Ext.NestedLayoutPanel(headerLayout));
layout.add('center', new Ext.ContentPanel('centerBody',
{fitToFrame:false, closable:false}));
layout.endUpdate();
//--------Events-----------
var toggleDivB= function() {
// This is being called correctly.
headerLayout.getRegion('center').collapse(true);
}
When I click the button with this, the region collapses, but there is a big blue empty space where it used to be and the other layouts don't resize. I've tried a number of different combinations of using collapse(), hide(), display:none, visibility:hidden/collapsed, but nothing seems to be working right.
I've been pretty successful in hiding the information I want to hide, but I've had no luck at all with resizing layouts. I know that regions have a resizeTo() function, but I would need to be able to find out the current height of the regions before hiding them to use that correctly. Any ideas?