-
1. Re: collabsibleSubTable does not use style of parent row
ibenjes Aug 9, 2013 4:32 AM (in response to ibenjes)Hi,
The only way I found to get this working is to use a rowKeyVar on the parent table and set the style of each of the columns in the collabsibleSubTable like shown below. I didn't find a way to apply this to the whole row. Anyway it works. You just need to make sure that you don't have any paddings/margin around the cells.
{code}
<rich:dataTable
value="#{testBean.address} var="address"
rowKeyVar="parentKey"
rowClasses="tableRowOdd, tableRowEven">
<rich:column>
#{address.name} <!-- Each row has alternating style -->
</rich:column>
<rich:collabsibleSubTable value="#{address.contactDetails} var="detail" expanded="true" expandMode="client">
<rich:column styleClass="#{parentKey % 2 eq 0 ? 'tableRowOdd' : 'tableRowEven'}">
#{detail.addressLine}
</rich:column>
<rich:column styleClass="#{parentKey % 2 eq 0 ? 'tableRowOdd' : 'tableRowEven'}">
#{detail.postCode}
</rich:column>
</rich:dataTable>
{code}
Please note
{code}
#{parentKey % 2 eq 0 ? 'tableRowOdd' : 'tableRowEven'}"
{code}
is not a mistake as the parentKey starts at 0 (otherwise you have to do (parentKey+1) % 2 eq 0 ? 'tableRowEven' : 'tableRowOdd'