Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
  • Tim Holloway
  • Carey Brown
  • salvin francis

GWT DataGrid Sorting and Coloring Cells (GWT 2.4)

Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
Don't sweat petty things, or pet sweaty things. But cuddle this tiny ad:
professionally read, modify and write PDF files from Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!