Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT DataGrid Sizing

I have a DataGrid which I want to grow vertically (height) as I add rows to it. The widget to add to the grid should be directly underneath the DataGrid. How do I do this?

The answer to "GWT DataGrid automatic height" was too obscure (if it was one). I tried placing the DataGrid in ResizeLayoutPanel, but it only shows the datagrid header.

like image 574
Joel Avatar asked Jun 14 '12 01:06

Joel


1 Answers

For those still struggling with CellTable (auto-height, pager always under the last line) and DataGrid (fixed header but height should be fixed and the pager will stay at the same place even if you got one line of data).

Don't forget they extend the same class : AbstractCellTable

So you can adapt your code easily (Note TableType is just an enum I created):

if (tableType == TableType.CELLTABLE) {
      // CellTable
      CustomTableWidgetCellTableResource resource = GWT.create(CustomTableWidgetCellTableResource.class);
      table = new CellTable<T>(10, resource);
    } else {
      // DataGrid
      CustomTableWidgetDataGridResource resource = GWT.create(CustomTableWidgetDataGridResource.class);
      table = new DataGrid<T>(10, resource);
      table.setHeight("470px"); // Default height
    }
like image 135
Michael Laffargue Avatar answered Sep 23 '22 23:09

Michael Laffargue