This content has been marked as final.
Show 8 replies
-
1. Re: Conditional cell background color in datatable
liuliu Mar 5, 2009 9:42 AM (in response to skynan507)
I think you need do it in your code java. -
2. Re: Conditional cell background color in datatable
nbelaevski Mar 5, 2009 9:52 AM (in response to skynan507)Hello,
Use styleClass="#{...}" -
3. Re: Conditional cell background color in datatable
skynan507 Mar 5, 2009 1:38 PM (in response to skynan507)Thanks nbelaevski,
thats it.
I did this two hours ago and it worked for me.
Best regrards -
4. Re: Conditional cell background color in datatable
nille May 5, 2009 5:52 AM (in response to skynan507)Hi,
I do have the case, that individual cells of a dataTable have to have a different background color than other cells of this dataTable. Using the 'styleClass' attribute of the 'rich:column' tag I can change the background color of the whole row, but I need to address the individual cell. Using the 'styleClass' attribute of the 'h:ouputText' (as the following)<rich:column> <h:outputText value="12" id="sumOfAllValues" styleClass="#{!t330RowItems.showSpecialField ? 'rich-table-green' : 'rich-table-cell'}"/> </rich:column>
is to 'late' because than the background color of the span is set but not of the generated 'td'. Is there a way to create cells with individual background colors?
Thanks in advance and kind regards,
Nille -
5. Re: Conditional cell background color in datatable
ilya_shaikovsky May 5, 2009 6:27 AM (in response to skynan507)Using the 'styleClass' attribute of the 'rich:column' tag I can change the background color of the whole row, but I need to address the individual cell.
1) not the whole row but whole column
2) and using EL in attribute for individual cell
ready comments above again -
6. Re: Conditional cell background color in datatable
nille May 5, 2009 6:40 AM (in response to skynan507)Hi,
1) not the whole row but whole column
sorry, I meant 'column'2) and using EL in attribute for individual cell
What attribute do you mean? For example I want one cell of the whole table to has a different background color. What attribute of which tag should I use? Using the 'styleClass' of the 'column' addresses to many cells and the attribute of the 'h:outputText' just the span inside the cell and not the cell (meaning TD) itself. Could you give me a hint. please?
Kind Regards,
Nille -
7. Re: Conditional cell background color in datatable
nbelaevski May 5, 2009 6:48 AM (in response to skynan507)Hello Nille,
Try this:<rich:column styleClass="#{!t330RowItems.showSpecialField ? 'rich-table-green' : 'rich-table-cell'}"> <h:outputText value="12" id="sumOfAllValues" /> </rich:column>
-
8. Re: Conditional cell background color in datatable
nille May 5, 2009 7:24 AM (in response to skynan507)Sorry guys,
I was sure I tried that and thought it would not work. Apparently, I did a mistake somewhere. So it works now, thanks a lot!
Kind Regards,
Nille