function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
vlotarevvlotarev 

Odd pageDataTable rowClasses behaviour

I am wondering why definition like:

 

 

...
rowClasses="odd, even"
...

 

 

produces markup like:

 

 

...
<tr class="dataRow even odd" onmouseover="if (window.hiOn){hiOn(this);}"
...
<tr class="dataRow odd even" onmouseover="if (window.hiOn){hiOn(this);}"
...

 

Why two style classes are specified together but not separately as mentioined in the documentation!? It's not possible to stylize properly even/odd row highlighting in this case ...

 

blombardisblombardis

Hi vlotarev,

 

rowClassesStringA comma-separated list of one or more classes associated with the table's rows, used primarily to designate which CSS styles are applied when using an external CSS stylesheet. If more than one class is specified, the classes are applied in a repeating fashion to all rows. For example, if you specify columnRows="classA, classB", then the first row is styled with classA, the second row is styled with classB, the third row is styled with classA, the fourth row is styled with classB, and so on.

 

I tested rowClasses and its working as it is mentioned in doumentation.

 

But I think the way your markup is shown it has to work. Because if you want the odd, even efect (I imagine you change bgcolor or something) second style shoud override the first one.

 

Can you post this fragment of your code?

Maybe I can help you.

 

 

vlotarevvlotarev

My code is primitive:

 

 

<apex:pageBlockTable 
    value="{!shoppingCartItems}"
    var="item"
    id="shoppingCartTable"
    rowClasses="odd, even"
    styleClass="results-table"
    headerClass="results-thead"
    footerClass="results-tfoot"
    rendered="{!shoppingCartItems.size > 0}">

    <apex:column value="{!item.SampleProduct__r.Name}" />

    ... bla-bla-bla ...

</apex:pageBlockTable>                    

 

Could you please put you working test code?

 

vlotarevvlotarev

Well, I did some testing. Regular <apex:dataTable> seems to work correctly but <apex:pageDataTable> renders wrong rowClasses. It's not possible to stylize rows correctly if both "odd even" are specified. The class that was declared first in CSS file takes precedence. The order in which they are specified in styleClass doesn't matter.

 

Could anybody advice something on that topic?