8

I'm trying to insert a gwt datagrid in my application. If i set a static height (500px) everything works nice. But i want to make the dataGrid auto adjust to screen size. With height 100% i get a blank screen. i've also tried to put the datagrid into a resizeLayoutPanel with the same results.

any tips?

MPelletier
  • 16,256
  • 15
  • 86
  • 137
Jose
  • 71
  • 3
  • 14

2 Answers2

19

All RequiresResize widgets should be given an explicit size, or be added to ProvidesResize widgets (up to a RootLayoutPanel or a ProvidesResize widget with an explicit size; the only exception is ResizeLayoutPanel which doesn't implement ProvidesResize because it couldn't honor the contract for its header and footer widgets, but it definitely honors it for the center widget).

So the question is: where did you add your DataGrid and/or ResizeLayoutPanel?

Thomas Broyer
  • 64,353
  • 7
  • 91
  • 164
  • The key point was ...be added to ProvidesResize widgets (up to a RootLayoutPanel). The parent panel was HTMLPanel and it is not a ProvidesResize widget. – Jose Oct 25 '11 at 09:31
  • 3
    You should "accept" the answer instead of changing the question title to "solved". See http://stackoverflow.com/faq#howtoask – Thomas Broyer Oct 25 '11 at 09:34
3

Thomas Broyer is correct. Nonetheless I found something of interest concerning the DataGrid (it does not happen in CellTable). If you are using a DeckPanel and if you are creating the DataGrid on a hidden Panel of this DeckPanel, than the data of the DataGrid will not be visible if you show the panel of the DataGrid. I found only one workaround: call addDataDisplay of your DataProvider "after" the panel was made visible.

S.Heitz
  • 31
  • 1
  • In most browsers, height and width of hidden div's (i.e. styled display:none) is not available to lay out the rest of the page. There are tricks to work around it, so I guess CellTable implemented it, while DataGrid didn't (or couldn't because it is slightly more complex) – Alex Pakka Jan 30 '13 at 07:18
  • Confirmed that this also affects a TabLayoutPanel where the DataGrid is not on the default tab. – unremarkable May 17 '13 at 15:45