DataTables / Responsive

Responsive extension for DataTables, providing support for complex tables on all device screen sizes
Other
148 stars 86 forks source link

deferRender on visible draws two columns if column has class none #103

Closed zisiszaverdas closed 9 months ago

zisiszaverdas commented 6 years ago

If deferRender is enable and the starting state of column visible:false and column has the class of none, when the visibility changes it cause to draw one column on responsive row body and one as a normal column but with a hidden header.

When the column is visible:true on column definition it's working fine.

Here is a screenshot http://prntscr.com/h7u3y1 and here is an example http://live.datatables.net/fasalugo/1/edit

In my example above when the office column becomes visible both on responsive detail row and as a normal column with a hidden header column.

DataTables commented 6 years ago

If a column has a class of none, it won't be shown in the DataTable, so having it in the list of buttons that the end user can modify is wrong (for example setting the column to be visible and none means that clicking on that button in the list will cause nothing to happen, which is a UX bug I would say).

I think the correct thing to do here would be to select only columns which don't have the class none to be shown in the list: https://datatables.net/extensions/buttons/examples/column_visibility/columns.html .

dswitzer commented 6 years ago

I'm seeing the same issue, but I need to be able to set the visibility of the column.

See my example here:

https://jsfiddle.net/dswitzer/z7u1nxrL/

We allow exporting of data and have some data that users want to decide if they want it to show or not.

So it's critical that users can toggle the visibility of a column, even if it's always supposed to render as a responsive data only.

The problem appears to be that if the deferRender is false, it's not properly setting the inline display: none on the column.

I'd really like to see this fixed.

DataTables commented 6 years ago

Thanks for the test case!

dswitzer commented 6 years ago

On a related note, the "control" column is incorrectly shown if the columns set to none are invisible.

AllanJard commented 9 months ago

Working with the latest versions: https://jsfiddle.net/emhubvs7/ . Sorry I missed updating this issue.