Grid + UiBinder : Setting row level styles

253 views
Skip to first unread message

karthik reddy

unread,
May 3, 2011, 12:25:00 PM5/3/11
to google-we...@googlegroups.com
...........
.........
<g:row addStyleNames="OddNumberRow">
....
....
</g:row>
<g:row addStyleNames="EvenNumberRow">
....
....
</g:row>
...........
...........
The above approach is not working. In other words, the "tr" elements in the generated html do not have any class names at all. A back up option would be to inject styles into these rows from the UiBinder's constructors (using getRowFormatter.addStyleName) but 
I do not want to take that route for now.(I wanna try to  reserve the code that goes into the UiBinder java class for event handling purposes only. )

Any thoughts/pointers would be much appreciated.



thanks

Alan Chaney

unread,
May 3, 2011, 1:14:15 PM5/3/11
to google-we...@googlegroups.com
Where are the styles defined? For example, if they are defined in the actual ui.xml file then
shouldn't they be somthing like:

addStyleNames="{style.OddNumberRow}" etc?

Regards

Alan

Message has been deleted

karthik reddy

unread,
May 3, 2011, 1:45:45 PM5/3/11
to google-we...@googlegroups.com, al...@mechnicality.com
I tried both approaches:

    <g:row styleName="OddNumberRow">    

and     <g:row class="{style.OddNumberRow}">

using <ui:style> declarations for the latter.

Neither of them work.

Thomas Broyer

unread,
May 3, 2011, 8:13:04 PM5/3/11
to google-we...@googlegroups.com


Le mardi 3 mai 2011 18:25:00 UTC+2, karthik reddy a écrit :
...........
.........
<g:row addStyleNames="OddNumberRow">
....
....
</g:row>
<g:row addStyleNames="EvenNumberRow">
....
....
</g:row>
...........
...........
The above approach is not working. In other words, the "tr" elements in the generated html do not have any class names at all. A back up option would be to inject styles into these rows from the UiBinder's constructors (using getRowFormatter.addStyleName) but 
I do not want to take that route for now.(I wanna try to  reserve the code that goes into the UiBinder java class for event handling purposes only. )

Any thoughts/pointers would be much appreciated.

That's simply not possible. The UiBinder parser doesn't look at attributes on the row/cell/customCell elements at all: http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/gwt/uibinder/elementparsers/GridParser.java 

Thomas Fischer

unread,
May 17, 2011, 9:27:44 PM5/17/11
to google-we...@googlegroups.com
I've added that functionality. It should be available with the next release.
Reply all
Reply to author
Forward
0 new messages