jQuery in Action, 3rd edition
The moose likes GWT and the fly likes GWT DataGrid Sorting and Coloring Cells (GWT 2.4) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Frameworks » GWT
Bookmark "GWT DataGrid Sorting and Coloring Cells (GWT 2.4)" Watch "GWT DataGrid Sorting and Coloring Cells (GWT 2.4)" New topic

GWT DataGrid Sorting and Coloring Cells (GWT 2.4)

Ron Meyer

Joined: Jun 26, 2012
Posts: 7

I try to sort an DataGrid which has color attributes set to its cell's programmatically.

I've done this via

This works great - note that on the real thing, the color code is different per row object and not static - so CSS does not work here.

I also override the DataGrids redraw method to color the cells like this:

This all works great, but then i switched to ListDataProvider because i needed column sorting.
But this doesnt work, only in some cases, the color is applied.
I believe its a time race.

If the columns sort identically, e.g. the click on Sort would not change the order, due to identical entries,
the color appears. If the order indeed changes, the cells are not colored.
Anyone knows what i'm missing here?

Since dataGrid.redraw() is not triggered by Sorting, i override the onColumnSort method in addition.
The dataGrid.redraw() should run after Sorting is done i believe .....

Any help is appreciated.
I agree. Here's the link: http://aspose.com/file-tools
subject: GWT DataGrid Sorting and Coloring Cells (GWT 2.4)
It's not a secret anymore!