Hide certain columns when page loads, but allow them to be added using colvis
Hide certain columns when page loads, but allow them to be added using colvis
u20241229
Posts: 4Questions: 2Answers: 0
Hi,
This is my simple test case: https://live.datatables.net/taborero/1/
By default, all columns are visible when the page loads:
- Name
- Position
- Office
- Age
- Start date
- Salary
I can show / hide columns since colvis is set in the JS to initialise the data tables.
Is there a way I can configure the settings so that e.g. Age and Start date are hidden when the page loads, but then can be made visible using the "Column Visibility" menu?
Any advice much appreciated.
Thanks
Jim
This question has an accepted answers - jump to answer
Answers
Use
columns.visibleto hide the desired columns. Updated test case:https://live.datatables.net/dusiloza/1/edit
Kevin
Wow! Thank you very much for your very fast and helpful reply.
Issue resolved, thank you!