StudioWorks
StudioWorks

Reputation: 493

How to style a row in rich:datatable acording to the row value or index?

I have a rich:datatable like so:

<rich:dataTable var="scheduledTimeItem" 
value="#{itineraryBean.weekDaysScheduledTimes}">
    <rich:column style="text-align: center;">
        <h:outputText>#{scheduledTimeItem.formattedStartTime}   </h:outputText>
    </rich:column>
</rich:datatable>

And I would like to, for example, put background-color: red in the style of that row if the value of scheduledTimeItem.formattedStartTime is greater than 17:00h or the current time for example.

How do I send the value of the row or its index to the bean at the time that is rendered?

Upvotes: 0

Views: 1137

Answers (1)

Turo
Turo

Reputation: 4914

You could do something like this

<h:outputText styleClass="#{scheduledTimeItem.style}">#{scheduledTimeItem.formattedStartTime}   </h:outputText>

for every column.

Upvotes: 1

Related Questions