Hi.

I have an application using a CellTable with paging. The CellTable
gets periodically updated with data through a ListDataProvider.setList
method. I would like to detect and highlight the rows that gets
updated with a flashing animation. I already used this flashing effect
in a previous implementation where I used a Grid instead of a
CellTable. The flashing effect is implemented by using the Animation
class and then apply a background color to the row like this
(simplified):

    DOM.setStyleAttribute(element, "backgroundColor",
currentColorHex);

Note that the element in this example i a TR element from a Grid
(Grid.getRowFormatter().getElement(rowIndex)).

My problem now is how to apply this flashing effect to my CellTable.

I have tried something similar to the above example like this:

 
CellTable.getRowElement(rowIndex).getStyle().setBackgroundColor(currentColorHex);

However, it doesn't work and I suspect it is because I get the
previous row element - that is the row element from just before the
CellTable is getting updated with new data.

Can you please help me!

A simplified code example looks like this:

    private FlowPanel panel = new FlowPanel();
    private CellTable cellTable;
    private ListDataProvider<MyObject> dataProvider;

    public void setupCellTable() {
        cellTable = new CellTable();
        dataProvider = new ListDataProvider<MyObject>();
        dataProvider.addDataDisplay(cellTable);
        SimplePager pager = new SimplePager();
        pager.setDisplay(cellTable);

        panel.add(cellTable);
        panel.add(pager);
    }

    public void updateData(List<MyObject> data) {
        dataProvider.setList(data);

        // Now detect which rowindexes have been changed since last
update ... code excluded here.

        // Assume that 'rowIndex' (int) has been updated and we want
to set the background color
        // 'currentColorHex' (String).
 
cellTable.getRowElement(rowIndex).getStyle().setBackgroundColor(currentColorHex);
    }


-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to