GWT DataGrid大小调整

时间:2012-06-14 01:25:44

标签: gwt datagrid sizing

我有一个DataGrid,当我向其添加行时,我想垂直增长(高度)。要添加到网格的窗口小部件应直接位于DataGrid下面。我该怎么做?

“GWT DataGrid自动高度”的答案过于模糊(如果是一个)。我尝试将DataGrid放在ResizeLayoutPanel中,但它只显示了datagrid标题。

1 个答案:

答案 0 :(得分:1)

对于那些仍在努力与CellTable(自动高度,寻呼机始终在最后一行之下)和DataGrid(固定标题但高度应该固定并且寻呼机将保持在同一位置的人,即使你有一行数据。)

不要忘记他们扩展同一个班级:AbstractCellTable

因此,您可以轻松调整代码(注意TableType只是我创建的枚举):

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
    }
相关问题