How to change a DataTable's Header class?
I have a datatable with 5 columns. And i want the header of the last column to have a different stylesheet. According to docs, i did this:
<h:dataTable columnClasses="columnClass1" headerClass="headerClass headerClass headerClass headerClass headerClass1" footerClass="footerClass" styleClass="dataTable" id="emps" value="#{pBO.model}" binding="#{pBO.modelTable}" var="item">
When i do this, only the last stylesheet is being applied to all the columns.
Isn't this how we are supposed to give different stylesheets to different columns? How does JSF assign the stylesheets?
# 2
Likely the tlddoc has been somewhat misleading or confusing:
http://java.sun.com/javaee/javaserverfaces/1.2/docs/tlddocs/ - h:dataTable - headerClass
Space-separated list of CSS style class(es) that will be applied to any header generated for this table.
By default HTML spec you can specify multiple CSS classes on one HTML element by passing them space-separated to the 'style' attribute. Nothing else is new and this is also not JSF specific.
And the tlddoc exactly states that you can pass a space-separated CSS style classes which will be applied to *any* header. You can confirm it yourself, look in the generated HTML source.
So what should be the solution? Use JS to crawl in the DOM and apply the styles accordingly.
jesef: columnClasses (and rowClasses) is commaseparated by the way.
# 3
Thank you Jesef and BalusC.
Jesef - I tried with columnClasses before too. It doesn't serve what i am looking for.
I just want to change the background of the last header to white.
BalusC, the other problem i have is that i cannot use "onload" function of the form. The current page is a part of template.