steps to reproduce:
1. create a table-style view exposing multiple content types
2. add fields from each content type, including at least 2 fields which only exist on one content type each
3. add "content type" field
4. group results by content type
5. assign fields from each content type to the same column
6. click "hide empty columns" in table display settings
expected behavior:
the number of result columns should match the number of header columns
"merged" fields should inherit "hide empty column" setting from the fields they're merged with
actual behavior:
if the "merged" field was not checked "hide empty column" before it was assigned to be merged with another column, it will cause an empty column to appear.
an extra result column causes the headers to appear misaligned.
for example:
create a view showing News and Events
add fields "News Date", "News Lede", "Event Start Date" and "Event End Date"
assign "News Lede" to "News Date" column
click "hide empty column" for "News Lede" in style options
assign "Event End Date" to "Event Start Date" column
click "hide empty column" for "Event End Date" in style options
result: "News" table has an errant column for "Event Start Date," presumably because it's still trying to render the empty "Event End Date" column.
Similarly, "Event" table has an errant column for "News Lede"
Let me know if it will help for me to post an exported view and/or screenshot.
I'm marking this minor because it's pretty obscure, and it can be fixed by first setting "hide empty columns" on the "merged" fields.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | views-combined_columns_empty-1778106-10.patch | 2.1 KB | anrikun |
Comments
Comment #1
dawehnerIf you can provide us a view everyone can import without additional effort like creating fieldapi fields you would make us happy.
This can often be a hard part.
I fear this could be tricky to test.
Comment #2
aaronbaumanOK, here is a pastebin of the view: http://pastebin.com/5e7jSxv5
And patch attached.
Basically, when the table style setting is submitted, this patch will ensure that if columns have been combined, child columns will inherit "empty_column" setting from their parents. I started writing this patch in views/theme/theme.inc template_preprocess_views_view_table(), but it seems like there's already enough stuff going on there.
I didn't see an obvious place to put a patch in the existing tests directory -- lemme know where you think it should go.
Comment #3
leanne9 commentedJust reading this helped me solve my issue- had to go back and check the boxes before "merging" for columns.
Comment #4
chris matthews commentedThe 6 year old patch to views_plugin_style_table.inc does not apply to the latest views 7.x-3.x-dev and if still applicable needs to be rerolled.
Comment #5
andrew answer commentedPatch rerolled.
Comment #6
anrikun commentedPatch at #5 works but requires each existing view to be re-edited.
Patch below adds changes in theme.inc to make it work for existing views too.
Besides:
Comment #7
anrikun commentedAn extra fix is needed: column header gets removed as long as one child column is empty, even if others are not.
This new patch addresses this issue too.
Comment #8
anrikun commentedI'm bumping this to expect the bug to be fixed in next release...
Comment #9
anrikun commentedI'm bumping this again to expect the bug to be fixed in next release...
Comment #10
anrikun commentedRerolled patch