Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF Datatable: How to style first row <tr>  RSS feed

 
Ajay Kamble
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any way in JSF to style ONLY the first <tr>, give it specific color etc.?

I know we can specify styles for alternate rows but I do not know how to style ONLY the first row.

Regards,
Ajay
 
Davie Lin
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I read about this last nite

use <f:facet> in your <h:column> tag

so look it up
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One way would be to stack 2 identical datatables (except for row classes), but that's cumbersome.

I think you could create a control binding and alter the rowclass for the first row, although I can't visualize all the details.

Or, if you're limiting the size of the table to, say 10 rows (for small or paged table displays), you can just do brute-force. I'm assuming you want both an alternate style of row 1 and ledger ruling:



Finally - and this is often the best way - are you actually just trying to create a heading row? Because dataTable has provisions for headers and footers.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!