I have a view with a table output.
I stripped all the label field from the header but the black bar of the header doesn't disappear.
Switching the theme to Picture Reloaded hides the header bar.

I believe the problem is into css/tables.css but not able to go more in depth.

CommentFileSizeAuthor
#2 table-header.png1.32 KBdimon00

Comments

Jeff Burnz’s picture

Category: bug » support

Sorry, I don't get your argument here - you are saying that there is no thead, yet thead exists? Please clarify.

dimon00’s picture

StatusFileSize
new1.32 KB

Sorry if I'm not clear.
I'm attaching a picture of my table.

It is a simple view which shows only the node NID.

The label of the column is hidden (by design).
So: if I don't have any column label I expect that the black bar (which I call the table header) is hidden as well.

That's the behaviour I see in Pixture Reload. However Corolla behave differently and shows the black bar anyway.
In my opinion the latter is not the right behaviour so i opened the bug.

Jeff Burnz’s picture

Yes, but the problem is not in the theme, the problem is with the View - what is happening is the View is outputting thead even when it has no content, this has nothing to do with theme which is only styling thead if is exists. The same markup will be there in Pixture Reloaded but you can't see it because it has no background color.

dimon00’s picture

Ok. As a workaround I changed thead background and font colours in tables.css.

Any possible side-effects?

Thank you for your support.

Jeff Burnz’s picture

The side effect is that any other tables will have transparent thead, and the text is white, so best is to try to target just that table, or the tables, if they have an ID use it. And when or if you upgrade later on you will need to redo it. Normal practice is to sub-theme, but if the changes are really minimal like this I would add a custom.css file and make sure to add it again after future upgrades, just to keep your edits clean and separated.

jenlampton’s picture

Here's an example preprocess function that makes empty thead tags go away

/**
 * Implements template_preprocess_views_view_table().
 * 
 * Remove thead if there are no col headers.
 */
function template_preprocess_views_view_table(&$vars) {
  if (!empty($vars['header'])) {
    $empty = TRUE;
    foreach ($vars['header'] as $col => $label) {
      if (!($label == '')) {
        $empty = FALSE;
      }
    }
    if ($empty) {
      $vars['header'] = array();
    }
  }
}

But I think the issue you are experiencing is actually a problem with views: #1309026: Don't render table header if all field labels are empty