开发者

How to programmatically update specific row in GWT CellTable

I have 5 rows in GWT CellTable. The table has 2 columns id, value. I have gwt timer which must periodically update value for specific id. So in timer implementation i call something li开发者_高级运维ke that:

....
double value = calcValueForId(id);
update(id, value);
.....
private void update(int id, double value) {
// here i have access to cell table instance and data provider (AsyncDataProvider)
// how to access row with given id and update its value column
}

Thanks.


You have to retrieve the item (of the type you used to parameterize your CellTable) and then you can call updateRowData of your AsyncDataProvider (or setRowData on the CellTable) with the item's index. This will tell that the items (actually only one in your case) starting at the given index have changed, so the table must be redrawn (for now, the whole table will be refreshed, but a later version of GWT might add "per row" refresh).

In your particular case though (only 5 rows and 2 columns), maybe CellTable isn't the best fit…

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜