I tried this way, but I couldn’t get this working. With the rendered HTML, I don’t see a width Attribute either for the Header or for the dataTable rows. I am using JSF 1.2 without any component libs. What could be the problem?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That linked answer honestly doesn’t make sense to me. The
<h:column>as it is in the default JSF implementation does not support those attributes at all. It’s far beyond me why it got 6 votes and is marked accepted. It’ll be ignorance or coincidence (maybe both the questioner and answer are using a JSF implementation I am not aware of which has a renderer for<h:column>which automagically converts all unknown attributes into real HTML attributes, but at least, the standard JSF RI / Mojarra doesn’t do that, MyFaces maybe?).That said, to style the columns separately, you need to make use of the
columnClassesattribute of the<h:dataTable>. It accepts a commaseparated string of CSS class names which will be subsequently applied on the<td>elemenes generated by<h:column>.This will end up as something like:
To specify the width, just apply CSS accordingly.