如何轻推一个填充了AsyncDataProvider的GWT CellList来刷新其内容?

时间:2013-03-05 17:05:00

标签: gwt

我使用AsyncDataProvider设置了一个CellList,它使用搜索字符串调用服务器。

当我的用户输入新的搜索字符串时,我希望CellList刷新。

如何告诉我的CellList刷新?我是否调用removeDataDisplay()然后调用addDataDisplay?

3 个答案:

答案 0 :(得分:4)

答案 1 :(得分:3)

你可以试试。

cellList.setVisibleRangeAndClearData(cellList.getVisibleRange(), true); 

Reload celltable issue

答案 2 :(得分:0)

您可以调用cellList.setVisibleRangeAndClearData( range, true) API来触发AsyncDataProvider的onRangeChange方法。

由于您使用的是Cell列表,因此上面提到了call should happen when the user scrolls to the end of the currently visible list。范围应该是 -

private Range range = new Range( cellList.getVisibleRange().getStart() + cellList.getVisibleRange().getLength(), cellList.getVisibleRange().getLength() );

cellList.setVisibleRangeAndClearData( range, true);