Joe*_*oel 6 gwt datagrid sizing
我有一个DataGrid,当我向其添加行时,我希望垂直增长(高度).要添加到网格的窗口小部件应直接位于DataGrid下面.我该怎么做呢?
"GWT DataGrid自动高度"的答案过于模糊(如果是一个).我尝试将DataGrid放在ResizeLayoutPanel中,但它只显示了datagrid标头.
对于那些仍在苦苦挣扎的人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
}
Run Code Online (Sandbox Code Playgroud)