Reputation: 7426
I'm trying to update the particular row of a cellTable without loading the page when clicking a button, which is in the same row.
I just want to update the Column1 which is a TextColumn. I want to Change the text of the particular column.
Can anyone help me?
Thanks in Advance, Gnik
Upvotes: 0
Views: 3841
Reputation: 41
If you want to redraw the whole row, you can use:
celltable.redrawRow(absIndex);
But if you want to update a single cell and performance is important you could do this in a child class of CellTable
public void updateCellContent(int absRowIndex, int cellIndex, String innerHtml) {
TableRowElement tr = getChildElement(absRowIndex);
if (tr != null) {
TableCellElement td = tr.getCells().getItem(cellIndex);
if (td != null) {
td.setInnerHTML(innerHtml);
}
}
}
Upvotes: 4
Reputation: 1171
Take a look at https://stackoverflow.com/a/7109021/787660
When you use the ListDataAdapter and add your row like in the example using the ListWrapper (don't be scared, you use it like a List-Object) the refresh is automatically triggered.
Upvotes: 1
Reputation: 14863
I suppose you use a ListDataProvider to store as it is used in the showcase example here.
In that case you just have to up change the data in the ListDataProvider and when its done just call
cellTable.redraw();
And don't worry the table doesn't flicker when doing that :)
Upvotes: 2