DataTables / DataTablesSrc

DataTables source repository
https://datatables.net
MIT License
628 stars 423 forks source link

toolbar option to hide/show columns w/ cookie support #293

Closed goodale closed 1 week ago

goodale commented 2 weeks ago

While it is possible to programmatically hide or show a column, there doesn't appear to be a UI component that provides the end-user the option to select which columns should be visible. I'm seeking a feature which provides this functionality. Requirements are similar to the (ancient) ExtJS/Sencha data grid control from many years ago:

This feature, once a standard component of ExtJS, seems to be missing from all of the various data table libraries. It would be very advantageous of DataTables supported it, possibly via an extension. End-users interacting with tables with a large number of columns would be able to more easily customize what they see and not have to export to Excel and then delete columns every time they export.

AllanJard commented 1 week ago

Like this? More examples here.

Column visibility should 'honored' by the Export extension

Set the columns option for the export buttons to be :visible.

The user's selections should be 'sticky' via cookies

Example here.

DataTables hasn't used cookies for state storing for many years. It uses localStorage by default, sessionStorage as an option. If you need a cookie, then use the state saving options of DataTables core to use cookies instead.