如何向/从celltable添加/删除动态列?

时间:2013-04-26 06:50:24

标签: java gwt multiple-columns gwt-celltable

我正在使用gwt celltable。

我的列可以通过其他模块进行配置。 使用AsyncDataProvider更新行数据。

在celltable中是否有任何方法只更新updateColumnData?这样新添加的数据就会插入到celltable中或从celltable中删除列。

假设,表中有10列。 用户可以配置celltable列

  • 用户想要删除2个选定的列然后进行服务器调用,并且相关的recordList对象以及columninfo(8列)即将到来,但在这种情况下,旧的10列数据和8列没有数据被填充到celltable

实际:18个列显示在单元格中,10列显示数据+ 8列无数据

预期: 8列记录

示例代码如下

 asyncDataProvider.updateRowData(startRowIndexOfPage, result);
                   if ("CONFIGURE".equals(eventType)) {
                        cellTable.redraw();
                       // To create column 
                        createCellTableColumns(latestColumnList); 
                    }
 cellTable.redraw();

结果:包含记录信息的记录列表 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);
                   }

怎么做?

0 个答案:

没有答案