I've just stucked into the same problem as thread starter did
I've attached a simple demonstration. It's build with GWTP 0.7, GXT 3.0.1, GWT 2.4.0. What it does:
BasePresenter is the one which handles basic application layout. NestedPresenter is the one that provides content for 'center' widget of BorderLayoutContainer in BasePresenter's view.
NestedPresenter generates 50 rows of data for Grid and injects them into it when handling RevealContentEvent is handled.
If grid is inserted with VerticalLayoutData(1, -1) the grid ignores page's bottom border and flows deeply under it (no scrollbar is provided). If VerticalLayoutData(1, 1) is used, then Grid preserves some space for vertical scrollbar (it's differable from previous view's render results) but Grid's body is rendered with height: 0px style property. I couldn't trace into where height is calculated.
Grid must be sized to work correctly. A lot of people get hung up on this, so I'm working on a Learn article discussing this and other layout bits, and we'll be adding some optional logging for layouts and sizing for the next version.
Grid needs to be given a size, so that it knows how much width it has for all columns (to allocate each column, to draw each row), and how height all rows will have (to set up the header and optionally footer so they never move, only the data moves).
Both Vertical- and HorizontalLayoutContainers accept three sets of values:
o Values greater than one are treated as specific pixel values
o A value of -1 means "Don't assign a size, trust the child to work out its own size"
o Values between 0.0 and 1.0 are treated as percentages of the leftover space from the above two.
By adding a grid to a VLC or HLC with layout data with a -1 value, you are explicitly telling the container to not size the grid. This results in the grid not knowing how much space it has, and it may make bad assumptions, resulting in extra scrollbars, or a very small grid.
This means that VerticalLayoutData(1,1) is almost certainly the right answer in your case, and the fact that this doesn't work suggests that its parent might not be sized correctly. I haven't taken the time to try out the sample project - setup is sometimes easy, but sometimes takes considerable time. If this post doesn't help, see if you can detail what your layout structure is, or see if you can build a simple class, implementing EntryPoint, that shows the layout.
If I understand you, your app basically looks like this:
--- Viewport (this sizes its child to the available browser size)
------- (setCenter) VerticalLayoutContainer
--------- (VerticalLayoutData: 1,1) Grid
If there is no viewport, the BLC won't be given a size automatically, so the VLC won't have a size, and so the Grid can't be given one. If you don't want a viewport, try setting a size on the BLC, which really can't function well without one.
No. Actually my point is:
And setting Grid to VLD(1, 1) I assume VLC has been set it's height correctly via ViewPort's autosizing, hence Grid's sizing should be done right way. But it doesn't. As the result I get a Grid with it's header shown correctly, filled with data rows, it's body height set to 0px and whole Grid container (a <div> containing header and body) with height value that equals header's height.
Oh, just forgot one tip:
to run my sample project from within Eclipse one need to first maven-package the project ( mvn clean compile gwt:compile package) then:
- on windows copy target/GTEST-0.0.1-SNAPSHOT/WEB-INF/lib/* to war/WEB-INF/lib
- on UNIX-like just make a symlink to ../../target/GTEST-0.0.1-SNAPSHOT/WEB-INF/lib to war/WEB-INF/lib
My problem has been solved. I did wrongly call ContentPanel.setResize(false) for the widget where Grid was placed.
After days of trying different solutions it worked like this:
vlc.add(grid, new VerticalLayoutData(1, 1));