Needs review
Project:
Views (for Drupal 7)
Version:
7.x-3.x-dev
Component:
table style
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
13 Oct 2011 at 19:32 UTC
Updated:
1 May 2019 at 13:42 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
rodych commentedI have the same problem, to fix it I add to the theme the attached file.
But I think hide blank table headers must be in the views core.
Comment #2
dawehnerPlease provide a real patch with proper codestyle.
Comment #3
mototribe commentedcreating a template override is a lot of work to just hide the table header ;-) You could do it quickly with some css.
I noticed the following (which might help fix the bug?).
When show a fieldA and turn the label off it shows the empty header with dark background.
Now I add another fieldB right before field A and turn the label off, exclude it from display and
in the table settings have fieldA show in the same column as fieldB.
The result is that the table header isn't shown.
Now I try to use the same trick on the first field. I insert a field before it, turn the label off and exclude
it from display. In the preview the header is gone. But after saving I get a bunch of errors:
Comment #4
JamesAn commentedThe code changes in #1309026-1: Don't render table header if all field labels are empty work, but I think it'd be more appropriate to put that logic in the preprocess function (and marginally more efficient since the logic can be embedded in the existing loop through all fields).
The attached patch introduces a theme variable, header_empty, that's set to TRUE if all labels are empty strings and FALSE otherwise. The template can simply check this variable before creating the thead element.
Comment #5
JamesAn commentedWe're actually not rendering or omitting the thead element, rather than just hiding it.
Comment #6
JamesAn commentedMy patch in #1309026-4: Don't render table header if all field labels are empty is actually made against 7.x-3.0-rc3.
Comment #7
zilverdistel commentedI made a simpler patch (against 7.3-3.x-dev) which should solves this, without introducing a new variable. Aditionnally, it makes the notices and warnings disappear.
Comment #8
zilverdistel commentedremoved the tag, (thought it was a title field for the comment)
Comment #9
dawehnerPlease add some intentation
Comment #10
zilverdistel commentedTnx for the quick review! Added some indentation.
Comment #11
dawehnerGreat looks perfect now, so committed to 7.x-3.x
It's probably helpful to backport this change
Comment #12
zilverdistel commentedVoila .. backported to 6.x-3.x.
Comment #13
dawehnerThanks! Committed to 6.x-3.x
Comment #15
jgpippin commentedI think the point of doing it as a tpl.php was not to have to use a patch. Personally, I prefer that approach.
Comment #16
dmitriy.trt commentedChecked 7.x-3.2 and it doesn't work. Views still render table header with empty cells because $header variable is not empty even when all labels are disabled. Quick fix is to check filtered header array instead of original.
Comment #17
dawehnerIt would be probably better to run array_filter in the preprocess code
Comment #18
dmitriy.trt commentedYes, you're right.
Comment #19
dawehnerEven this might be hard to believe but i fear that people actually expect that a table with empty headers still appear. Maybe a settings should be used instead, but i'm not 100% sure about that.
Comment #20
jenlamptonIf there are no labels, there certainly should be no header. That's why this is a bug report. :)
I've reviewed the patch and it works perfectly, thanks for the work on this!
Comment #21
dawehnerSome time ago i made some experience with people when some new css classes got added.
But sure i can refer to this issue if someone complains :p
Comment #22
mototribe commentedworked for me too! Thanks a bunch!
UWE
Comment #23
giorgio79 commentedThanks, I can confirm as well that Views 7 dev version works :)
Comment #24
dmitriy.trt commentedPort to 6.x-3.x. Also prevents
colspan="0"on empty text cell.Comment #25
dmitriy.trt commentedAlso, attaching patch for 7.x-3.x with the fix for appearing
colspan="0".Comment #26
13rac1 commentedFixes go to current dev (7.x in this case) before being applied to 6.x. This patch combines #18 and #25. Please test and rtbc.
Comment #28
13rac1 commentedArgh. I'm not working on my normal computer... try this one bot!
Comment #29
dmitriy.trt commented#18 has been already committed, so just use #25 for 7.x-3.x to apply fix for
colspan="0".Comment #30
chris matthews commentedThe 6 year old patch in #29 does not apply to the latest views 7.x-3.x-dev and if still applicable needs a reroll.
Comment #31
andrew answer commentedPatch rerolled.
Comment #32
andrew answer commentedComment #33
andrew answer commentedPatch rerolled/fixed after last commits.