odd/even styles for rows

3 views
Skip to first unread message

Nick Nadgauda

unread,
Jul 25, 2007, 9:15:57 AM7/25/07
to GWT-Stuff
Hi,

I'm trying to get different styles for odd and even rows in an
ObjectListTable, but can't figure out how. In the Renderer.render( )
method, there's no way I can see to determine the row number from the
TableBodyGroup. If I try and apply the shading to the ObjectListTable
directly (outside the renderer), there's no way to get a handle to
underlying TableRow objects.

Am I looking at this the right way? Do you have any suggestions?

Thanks,
--Nick

Sandy McArthur

unread,
Jul 25, 2007, 12:41:14 PM7/25/07
to gwt-...@googlegroups.com
ObjectListTable doesn't directly support this because table rows can
change without the renderer being called.

eg: Imagine a zebra table for the objects [ A, B, C, D, E ] and the
rows for B and D are darker. if you call olt.getObjects().remove(C)
then the dark rows for B and D will be next to each other.

I suggest you use a thin border between each table row, like gmail
does, instead of different background colors. Maybe in some browsers
you could use advanced CSS for odd/event elements and have that work
correctly.

That said the Renderer can find the row number by calling
olt.getObjects().indexOf(foo).


--
Sandy McArthur

"He who dares not offend cannot be honest."
- Thomas Paine

Reply all
Reply to author
Forward
0 new messages