Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
While tables in Views 3 do a great job of allowing us to include the field names as classes for every TD, the table headers (TH's) don't have this capability.
Instead, a view of the source code shows a string of
elements. There's no affordance in the Views 3 interface for adding this, either.
This feature was previously available through Semantic Views in Views 6.x, I believe.
Comments
Comment #1
modulist CreditAttribution: modulist commentedUm, that would be <th class="">... </th> elements.
Comment #2
dawehnerSo this is more like a feature request.
Comment #3
merlinofchaos CreditAttribution: merlinofchaos commentedI would say class="" is a bug.
And classes on td should be applied to the th as well. I thought i had set that up so that row 0 would be used for tokens there, but maybe I either messed that up or only did it in my head.
Comment #4
dawehnerIt's kind of hard to find it out.
If you want to add classes to the header of the table you have to configure the "Customize label HTML" setting on the field
and add a custom class there.
Once you have set this up you will see the classes.
Comment #5
merlinofchaos CreditAttribution: merlinofchaos commentedOh right! The header is the label when tables are in use!
Comment #6
dawehnerSo there could be some documentation about this.
Comment #7
merlinofchaos CreditAttribution: merlinofchaos commentedOk, fixed the table template so that it won't print empty class tags.
I'm not really sure that we need additional documentation about this anywhere. The th tag is the label. You do have to add a class to the label if you're going to.