View Full Version : Set panel height relative to parent panel

5 Aug 2009, 11:40 PM
I have a center panel in a border layout containing a center and a south panel. I need the panels in the container to have a relative height (50% - 50%). I've searched the forums and tried everything I could think of, but I can't figure out how to do this.... Can anyone tell me what I should do?

5 Aug 2009, 11:58 PM
Either switch to VBoxLayout or use this BorderLayout patch (http://extjs.com/forum/showthread.php?p=287261#post287261).

6 Aug 2009, 12:18 AM
Thanks Condor! Your patch works pretty well!
Great to read that it probably will be integrated in 3.1 :)

6 Aug 2009, 1:34 AM
After testing some more I ran into about five problems. So I've used the modified version (last post in the thread by PierceSD (http://extjs.com/forum/member.php?u=65610)). This fixes all 5 bugs, but introduces two new ones.

I'm not allowed to reply on the original thread, so I'll post the bugs here, hoping they can be fixed. This is the exact solution I was looking for.

The bugs:
1. The panels can't be resized. When resizing the content of the panel grows or shrinks accordingly, but the panel size stays the same.
2. The first attachment contains a screenshot showing the page I'm working on when the page is initially loaded, the second shows the page after the window has been resized.
The most right panel should start collapsed. It's collapsed, but there still is a gray bar showing and the 'clickable bar' isn't showing at all. After resizing the page, the gray bar disappears and the clickable bar show. But I don't want the customer to have to resize the page for it to show properly, obviously :)

Using the 'relHeight' property instead of 'height' introduces some different problems, but I won't go into that because the relative 'height' property almost does what I need it to do.

Any help will be highly appreciated!

6 Aug 2009, 1:42 AM
Panels can be resized. Call setSize on them. Or use the splitbar.

Panel's do not "stretch" to accomodate whatever content is in them. That's not what size-managed layouts like border layout do. They can offer scrollbars so that overflowing cnotent can be viewed.

6 Aug 2009, 2:07 AM
I'm using a splitbar and resizing the panel was working fine before adding the extension with a fixed panel height :)
With the extension added the splitbar is still available, but the relative height can't be adjusted using the splitbar, so it seems. I understand using setSize could be a solution, but that would make it a lot more complex then necesairy. I'd rather use the splitbar as intended.

I hope I'm explaining clearly enough.

10 Aug 2009, 5:11 AM
I've fixed it like this....even though the panel height won't be adjusted when the window has been resized, it will do for now...


10 Aug 2009, 5:21 AM
What about the patch Condor pointed you to?

That does everything you want doesn't it?

10 Aug 2009, 5:30 AM
Correct, that's the perfect solution. But it's not working very well. I've tried the suggested modifications, which fix the original bugs, but also introduce new ones. I'm under pressure to finish my app, so I don't have the time to look into fixing the bugs (maybe later). The simpler solution will do for now. I appreciate the suggestion though! :)