Show / hide columns dynamically - Saving settings
Show / hide columns dynamically - Saving settings
helpdesk
Posts: 20Questions: 3Answers: 0
Hi All,
is there a chance to save status of hidden columns so after page reload they will be still hidden?
https://datatables.net/examples/api/show_hide.html
Thanks,
Jakub
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Yes - simply use the
stateSave
option.Allan
Thank you,
is there a chance to flag links somehow to show which columns are hidden, it would be very useful once web page is being reloaded? I can achieve this by saving status to the DB, just was wondering that is there already something on place that will simplify it :)
And the second, I'm using columns search option as well, and once table / web page is being refreshed filters are saved but they don't appear in the search boxes so can be confusing to find out which filter was applied, and ideas how to input original filter there or just don't save state of these?
Thanks,
J
I would suggest simply using Buttons. It has lots of column visibility control options.
If you don't want to use Buttons, then yes, you would just need to use
columns().visible()
to check each column an update the link accordingly.Allan
Thanks,
what about applied columns filters?
Jakub
DataTables knows nothing about the inputs for the column filters, so you would need to apply the saved values when the state is loaded to your input elements. You can get the loaded state using
state.loaded()
.Allan