-
24 Jun 2012 11:11 PM #1
Answered: GXT Grid sizing issue
Answered: GXT Grid sizing issue
Hi guys,
since few days I have an issue with the grid and I am completely stopped.
I have a GWT tab panel and inside a ContentPanel that should resize his child: the Grid.
When the page is loaded for the first time the vertical bar is not visible, even if is needed, but if I resize the window the vertical bars are shown correctly.
Does anybody could explain me the reason and provide me some ideas to solve it?
-
Best Answer Posted by Colin Alworth
I havent tried this exact case, but in similar cases this can be caused by the GWT layout containers not providing resize information on page load, but only on subsequent resizes. This works out okay if your content only needs html/css to render sizes (like the ContentPanel), but if the content needs actual width/height information (as in the case of the Grid to size its scroll container, headers, columns correctly) initial sizes must be provided.
The general fix is usually to invoke forceLayout() on the TabLayoutPanel or its parent after it all has been added to the RootLayoutPanel.
-
25 Jun 2012 7:44 AM #2
I havent tried this exact case, but in similar cases this can be caused by the GWT layout containers not providing resize information on page load, but only on subsequent resizes. This works out okay if your content only needs html/css to render sizes (like the ContentPanel), but if the content needs actual width/height information (as in the case of the Grid to size its scroll container, headers, columns correctly) initial sizes must be provided.
The general fix is usually to invoke forceLayout() on the TabLayoutPanel or its parent after it all has been added to the RootLayoutPanel.
-
26 Jun 2012 12:08 AM #3
Hi Colin, thank you very much for the quick answer and to explain me this proble of GWT.
I tried your fix and seems really logical.
these are the step
* create the grid
* populate the grid
* add the grid to the ContentPanel
* add the ContentPanel to the TabLayoutPanel (without specifying size, I want that it takes the whole space)
* add to RootLayoutPanel
* forceLayout() on TabLayoutPanel
RESULT: the ContentPanel has disappeared (it looks size 1x1 pizels)
-
4 Jul 2012 5:20 AM #4
SOLVED!!!!
the solution is to add the ContentPanel (containing the grid) to the RootLayoutPanel and afterward to forceLayout()....
thank you
Code:ContentPanel panel = new ContentPanel(); RootLayoutPanel.get().add(panel); RootLayoutPanel.get().forceLayout();


Reply With Quote