View Full Version : Auto height for the last component in Layout

11 May 2010, 11:58 AM
Is it possible to autoheight the last component added to a given layout, so it will fill the remaining empty space?

For example:
I have a parent LayoutContainer with RowLayout or FitLayout set and a height of 400 pixels.
I sequentially add 3 containers, where for the first 2 containers have height of 100 pixels each, so when add the last container I want it to automatically fill in the remaining space (200 pixels).

Is this possible?

11 May 2010, 11:54 PM
I think it is possible if you use FitLayout and set the margin bottom of your las component to 0.
but I think also that if you don't try you will never no and that is the best way to learn !!! :d

12 May 2010, 12:50 AM
FitLayout does not work in this case, because the first widget you add will auto expand to cover all available free space. Any widget you add after that will not be visible.
Only solution I can think of is to have BorderLayout with north, center and south areas, but there is a lot of unnecessary overhead associated with this since ContentPanel has a lot of functionality that I don't need in this particular case (show/hide, header, etc.).

12 May 2010, 12:51 AM
FitLayout only handles one component, it it will never work for that case.

RowLayout cna handel this. Give it a specific rowdata. This is even handled in the examples: http://www.extjs.com/examples/explorer.html#rowlayout

12 May 2010, 1:16 AM
thanks for your correction it will be useful for me too