GWT DataGrid Size

I have a DataGrid that I want to grow vertically (height) when I add rows to it. The widget to be added to the grid should be directly below the DataGrid. How to do it?

The answer to "Automatic GWT DataGrid Height" was too obscure (if it was one). I tried placing the DataGrid in a ResizeLayoutPanel, but it only displays the datagrid header.

+6
source share
1 answer

For those who are still struggling with CellTable (auto-height, the pager is always under the last row) and DataGrid (fixed header, but the height should be fixed, and the pager will remain in one place, even if you have one row of data).

Remember that they extend the same class: AbstractCellTable

This way you can easily adapt your code (Note TableType is just an enumeration 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 } 
+1
source

Source: https://habr.com/ru/post/918049/


All Articles