Carousel - Conditional Coloring with itemStyleClass

UI Components for JSF
Post Reply
alex_keila
Posts: 4
Joined: 02 Sep 2011, 22:57

05 Dec 2011, 14:49

Hi,

I use PrimeFaces 2.2 RC2 and I am trying to make conditional coloring on the Items of a Carousel Component, like the one made with a DataTable in the example: http://www.primefaces.org/showcase/ui/d ... loring.jsf. But, instead of using rowStyleClass, I am using itemStyleClass.
However, it is not working.
Here is a fragment of my code:

Code: Select all

<p:carousel rows="10" scrollIncrement="9" itemStyleClass="#{ empty rowIx or rowIx mod 2 ne 0 ? 'even-row' : 'odd-row' }" widgetVar="rowIx">
<!-- Some tabs inside -->
</p:carousel>
CSS code:

Code: Select all

.even-row {
    background-color: silver;
}
.odd-row {
    background-color: green !important;
}
It only gets the even-row features, what makes me suspect that the widgetVar attribute does not work as a row index as the rowIndexVar of the DataTable does.
Is it possible to do this kind of conditional coloring in a Carousel. If so, which attribute do I have to use to identify each of the items of the Carousel.

I would really appreciate if someone could help me with this issue.

Thank you a lot in advance.

Alex

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 33 guests