This content has been marked as final.
Show 1 reply
-
1. Re: Highlighting rows in rich:dataTable based on the row content
linuxtuxie.j_007_b.live.com Jan 14, 2009 10:41 AM (in response to linuxtuxie.j_007_b.live.com)I solved my own problem by implementing the following code:
Instead of generating the rowClasses attribute for the rich:dataTable tag, I generate the value for the styleClass attribute on the rich:column tag for each row. Each time the dataTable gets rerendered (due to filtering or sorting) it calls the getColor method for each cell
example:
<rich:dataTable id="itemData" var="item" value="#{items}" reRender="ds" rendered="#{items.rowCount!=0}"> <rich:column styleClass="#{item.color}" sortBy="#{item.name}" filterBy="#{item.name}" filterEvent="onkeyup"> <f:facet name="header">Name</f:facet> <h:outputText value="#{item.name}" /> </rich:column> <rich:column styleClass="#{item.color}" sortBy="#{item.value}" filterBy="#{item.value}" filterEvent="onkeyup"> <f:facet name="header">Value</f:facet> <h:outputText value="#{item.value}" /> </rich:column> ... ... <f:facet name="footer"> <rich:datascroller id="ds" renderIfSinglePage="true"/> </f:facet> </rich:dataTable>
And here item.color contains the texts greenRow;redRow;... which on its turn is defined in the stylesheet