Alternate colors in Datatable

UI Components for JSF
Post Reply
Lotfus
Posts: 46
Joined: 14 Mar 2011, 13:02
Location: Swtizerland-Lausanne

30 Mar 2011, 11:55

Hello,

in primefaces Datatable showcases, there is an example on conditional coloring.

I am looking for something differnet: Is anybody aware of any mean to have two alternate colors, i.e. line N is white, and line N+1 is grey ?

Thanks

danielandross
Posts: 29
Joined: 14 Feb 2011, 12:39

30 Mar 2011, 13:27

I would be interested int that too, if there is a way not using css. So just primefaces tools

primeuser2412
Posts: 23
Joined: 18 Mar 2011, 03:49

30 Mar 2011, 13:47

Just override Primefaces default stylesheet classes, as in:

.ui-datatable-odd { background:#f0f0f0; } // light silver
.ui-datatable-even { background:#ffffff; } // white

You can find other stylesheet classes by opening the primefaces-2.2.1.jar with 7zip or Winrar and drill down to the \META-INF\resources\primefaces directory. You will find there a list of all Primefaces' components. Select the component you want (e.g. datatable) and look inside its accompanying stylesheet(s) (e.g. datatable.css). You will find the class names inside the stylesheet(s) so just override a class name in your own stylesheet like the examples above. Then you're good to go! :D

Lotfus
Posts: 46
Joined: 14 Mar 2011, 13:02
Location: Swtizerland-Lausanne

30 Mar 2011, 16:34

Yes it works, thank you!

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 69 guests