You need to sign in to do that
Don't have an account?
bozotheclown
Alternating row colors in datatable
Hello. Does anyone know the code needed to alternate background color rows in a datatable? In other words, I want odd rows to have a white background and even rows should have a gray background. I am trying to use.p:nth-child(even)/p:nth-child(odd)...but that code does not seem to be working.
Thanks in advance.
The CSS nth-child construct isn't supported by all browsers - IE and some versions of firefox spring to mind.
If this isn't a PDF document then you can do it via javascript - there's a good tutorial for achieving this using jquery at:
http://docs.jquery.com/Tutorials:Zebra_Striping_Made_Easy
Hi,
You can use rowClasses attribute of <apex:dataTable>.
For example,
Hope this helps :)
Thanks,
Devendra
https://sites.google.com/site/infallibletechie/code-for-alternate-background-color-for-rows-in-a-pageblocktable
Regards,
Magulan D
Salesforce.com certified Force.com Developer.
SFDC Blog
SFDC Site
If this post is your solution, kindly mark this as the solution.
And how would you do the same for five different colors, alternating color based on a record value?
Thanks