Problem/Motivation

The "Hide empty column" option (from the regular table style) isn't working with Views DataTables formatter.

Steps to reproduce

Create a view with core's Table style and select "Hide empty column" option for columns which can be empty.
Create entities displayed in the views with empty columns and see that these columns are not appearing
Switch to Views DataTables style and see the previously hidden columns.

Proposed resolution

Fix hiding of empty columns.

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork datatables-3279226

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Anybody created an issue. See original summary.

anybody’s picture

The empty columns are already visible wihtout DataTables applied to the view. You can see that with disabled JavaScript.

anybody’s picture

Ok I found it! It's the template_preprocess function in datatables.module, which re-adds the removed empty headers. I'll create a MR.

anybody’s picture

Status: Active » Needs review
thomas.frobieter’s picture

Status: Needs review » Reviewed & tested by the community

Works for me!

anybody’s picture

Title: Hide empty column option broken » Hide empty column option & grouping broken
Status: Reviewed & tested by the community » Needs work

Now I saw that grouping is also broken... The group is inserted as first column. Reopening to fix this combined, as might be related.

Edit: No, it's unrelated! ;) Happens with and without the patch.

Edit2: Back to RTBC. This is so unrelated that we should not X-post it here... And quite special to our table with grouping, hidden fields, etc... Let's separate this.

anybody’s picture

Status: Needs work » Reviewed & tested by the community
anybody’s picture

anybody’s picture

Status: Reviewed & tested by the community » Needs work

Update... I found it. Both had the same root cause, I'll fix it in the MR. Needs review again afterwards.

anybody’s picture

Status: Needs work » Needs review

Update... I found it. Both had the same root cause, I'll fix it in the MR. Needs review again afterwards.

thomas.frobieter’s picture

Status: Needs review » Reviewed & tested by the community

Works for me too.

diqidoq made their first commit to this issue’s fork.

  • diqidoq committed e02c0a57 on 2.x authored by Anybody
    Issue #3279226 by Anybody: Hide empty column option & grouping broken
    
dqd’s picture

Awesome work and finding! Again @Anybody! ;-) +1

dqd’s picture

Priority: Major » Normal
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.