Search code examples
gwtuibinder

Grid + UiBinder : Setting row level styles


...........
.........
<g:row styleName="OddNumberRow">
....
....
</g:row>
<g:row styleName="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.

Note: Cross posted at https://groups.google.com/forum/?fromgroups#!topic/google-web-toolkit/yGRUkpcpBzU

thanks


Solution

  • You are right, this does not work. I have also tried adding the style to g:customCell, which does not work either.

    The only way I can think of is using a SimplePanel to wrap your content in:

    <g:row>
      <g:customCell>
        <g:SimplePanel width="100%" height="100%" styleName="OddNumberRow">
          <g:Label>Content</g:Label>
        </g:SimplePanel>
      </g:customCell>
    </g:row>
    <g:row>
      <g:customCell>
        <g:SimplePanel width="100%" height="100%"  styleName="EvenNumberRow">
          <g:Label>Content</g:Label>
        </g:SimplePanel>
      </g:customCell>
    </g:row>