我正在使用 gwt 单元格表。
我的列可以通过其他模块进行配置。使用 AsyncDataProvider 更新行数据。
celltable 中是否有任何方法可以仅更新ColumnData?以便将新添加的数据插入到单元格表中或从单元格表中删除列。
假设表中有 10 列。用户可以配置 celltable 列
- 用户想要删除 2 个选定的列,然后进行服务器调用,并且相关的 recordList 对象以及 columninfo(8 列)即将到来,但在这种情况下,旧的 10 列有数据和 8 列没有数据被填充到 celltable
实际:celltable 中显示 18 列,10 列有数据 + 8 列无数据
预期: 8 列有记录
示例代码如下
asyncDataProvider.updateRowData(startRowIndexOfPage, result);
if ("CONFIGURE".equals(eventType)) {
cellTable.redraw();
// To create column
createCellTableColumns(latestColumnList);
}
cellTable.redraw();
result : 带有记录信息的记录列表 latestColumnList : List : 带有列信息的更新的列数
我只想在来自服务器的 celltable 中显示新数据(列+记录数据)
编辑尝试以下列方式创建具有新列数据的新单元格表,但未添加/删除旧单元格表的新列没有用。
if ("CONFIGURE".equals(eventType) ) {
asyncDataProvider.removeDataDisplay(cellTable); // remove old celltable
cellTable = createNewCellTable(); // after column config create new celltable
pager.setDisplay(cellTable);
pager.setSearchRecordCount(searchRecordCount);
asyncDataProvider.updateRowData(startRowIndexOfPage, result);
createCellTableColumns(latestColumnList());
asyncDataProvider.addDataDisplay(cellTable);
}
这个怎么做?