If no value has been given for any field collection entity for a particular field, then that field's column should not show up in the table.

Comments

tim.plunkett’s picture

Status: Active » Postponed

Views doesn't do it, CCK multigroup doesn't do it, and even Station module doesn't do it for its playlists.

If you have an idea of how to iterate through a list of tabular data and discover when a column is unused, I'd love to hear it.

Marking postponed for now, but I know of no way to accomplish this.

I appreciate you filing this as a feature request, not a bug! :)

tim.plunkett’s picture

Status: Postponed » Needs review
StatusFileSize
new3.48 KB

I think this is likely a bad idea, since it's bad for performance and might break nested field collections and bunches of other things (it has to loop through each row and field after being populated, and then re-loop through each row). But it is a valid use case. I might be able to make this extensible from a custom theme/module...

We'll see. Please apply this patch, clear your caches, then go to admin/config/user-interface/field_collection_table.

justmagicmaria’s picture

Again, thanks the the blazingly fast response to my request! I applied the patch, cleared the cache a few times, then switched the config setting to Hide empty columns. Unfortunately, it hides the wrong column. I have three, the first two which have data, and the last which is empty. It hides the second, not the third, column.

tim.plunkett’s picture

StatusFileSize
new12.72 KB

Alright, I think I found that bug. Can you try this patch? You'll need to revert the previous one first, and also clear your caches again.

chalee’s picture

Does the above patch solve the issue I have. I don't want a field that is set as hidden in the 'Manage display' page to appear as column in the table. Currently the field values are not showing but the column still appears showing the header label.

tim.plunkett’s picture

@chalee, did you try it? It does fix it.

justmagicmaria’s picture

Fabulous, Tim! Yes, the latest patch worked beautifully.

chalee’s picture

@tim.plunkett, Yes I tried the patch but it's not working for me. The empty column is still there showing the header label.

justmagicmaria’s picture

@chalee, did you clear you caches?

chalee’s picture

Yes, I cleared cache several times.

tim.plunkett’s picture

chalee’s picture

Patch works thanks

Status: Fixed » Closed (fixed)

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