Adding CSS classes per column

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Adding CSS classes per column

hughes.matt
I've been using this library for some months now with everything working pretty well, but I recently discovered that the class attribute for the <display:column> tag is only evaluated once.  I was under the impression that it would be evaluated every time the <display:table> tag looped through.  I,e. if you have the following:

<c:set var="cssClass" value="goodNumber" />
<display:table>
<c:choose>
  <c:when test="${number > 25}">
    <c:set var="cssClass" value="goodNumber" />
  </c:when
  <c:otherwise>
    <c:set var="cssClass" value="badNumber" />
  <c:otherwise>
</c:choose>
  <display:column property=".." class="${cssClass}" />
</display:table>

The class for that column will be the  same  in every row; in other words,  the ${cssClass}  is only ever being evaluated once, not each time.

I find this is a major issue.  Looking at the latest source, I see that the RowDecorator class has added a method, addClass(), enabling the user to add a css class onto the <tr> element.  I think this needs to be added to ColumnDecorator as well; is anyone working on this?

Personally, I favor just having the <display:table> tag evaluate these properties through each iteration rather than forcing me to create a decorator, but that may have some speed problems.