PDA

View Full Version : Scrollbars do not appear



alexworden
10 Aug 2010, 10:22 AM
Hi,

I'm constantly baffled by GXT and how difficult it is to get the scrollbars to work. Can anyone point me at some *good* documentation on how to get scrollbars to work and the pitfalls of the multitude of containers / layouts etc?

Here's my current layout hierarchy - for which inexplicably no scrollbars appear at all. This layout gives me a form with a title at the top followed by two columns of sections containing form components.

ContentPanel with FitLayout
--LayoutContainer with VBoxLayout
----Label (The Form Title)
----FormPanel with HBoxLayout

------LayoutContainer with VBoxLayout
--------(then one of more of...)
--------LayoutContainer with TableLayout
----------(then one of more of...)
----------LayoutContainer with FormLayout
------------DateField
----------LayoutContainer with FormLayout
------------TextField
----------LayoutContainer with FormLayout
------------SimpleComboBox

------LayoutContainer with VBoxLayout
--------(then one of more of...)
--------LayoutContainer with TableLayout
----------(then one of more of...)
----------LayoutContainer with FormLayout
------------DateField
----------LayoutContainer with FormLayout
------------TextField
----------LayoutContainer with FormLayout
------------SimpleComboBox

The FormLayout seems to be necessary to get the form fields to render correctly.

Everything renders OK but extends off the bottom of the screen, despite calling setScrollMode(Scroll.AUTO) on the top container. I've tried setting this on the top three containers and no scroll bars ever appear.

I've read somewhere that some containers just don't report their size or propagate size events up/down the hierarchy so that scrollbars don't work but I've yet to find a good explanation of this. Can anyone explain why my hierarchy listed above doesn't work?

Thanks!

Colin Alworth
11 Aug 2010, 10:21 AM
Have you set a size for the parent container? If it is the parent container and has no size, it won't know when to start to scroll.

If you added a ViewPort as the parent of the current parent, it would size the current parent to the size of the screen.

alexworden
16 Aug 2010, 11:50 AM
BTW - I don't have the option of using a ViewPort as the parent but I'd like to learn more about it. Is there any documentation available?

Anyway, I am stuck with a "ContentPanel" because of the architecture of the software. Drilling down into the guts of ContentPanel it does some highly complex things with it's child components in the overridden onRender() method and doesn't seem to rely on standard LayoutContainers :(

I changed from using VBoxLayout / HBoxLayout etc to nested TableLayout(s) and the scrollbars now appear. This says to me that there is clearly a bug with VBoxLayout / HBoxLayout etc and they just don't work correctly inside a ContentPanel.

Ideally, the size of any group of components needs to be determined by calculating the 'minimum size' of each individual component and how it is layed-out by it's parent container, taking into account padding and margins etc. This needs to be calculated from the BOTTOM UP to determine if scroll bars are necessary. Since there is no mechanism for this in GXT, I can only presume it is all fundamentally broken. Perhaps this boils down to HTML / CSS deficiencies?