Toggling column visibility removes table header title
Hi,
I am using KTDatatables Metronic v7 and want to toggle column visibility.
datatable.column(parseInt(val)).visible(false);
This works perfectly in terms of removing the column from view and setting the parameter to true again to bring it back. However on bringing it back the table header column title is not restored. I need to execute an extra
datatable.reload();
How can I remove a column from view and bring it back including the table header?
Replies (6)
Hi,
Could you please try to use this function?
datatable.redraw();
Thanks
I tried. Does not work unfortunately.
datatable.column(parseInt(val)).visible(true);
datatable.redraw();
Hi Tristan,
Sorry for the inconvenience. Please note that we have stopped providing updates for KTDatatables since Metronic v8. For future data table updates, we use the Datatables.net plugin.
In our online demo, showing and hiding a column is working.
https://preview.keenthemes.com/metronic/demo1/crud/ktdatatable/api/methods.html
In file;
\theme\demo1\src\js\pages\features\ktdatatable\api\methods.js
Please try to use datatable.columns instead of datatable.column function.
datatable.columns(parseInt(val)).visible(false);
Thanks
Hi!
I tried to use columns instead of column, but this give error:
TypeError: undefined is not an object (evaluating 'delete options.columns[index].visible')
I checked the example of again
\theme\demo1\src\js\pages\features\ktdatatable\api\methods.js
and applied it to my code. It works now. Thanks!
Hi Tristan,
Sorry for the delay. Glad you found it. Feel free to let us know if you need any help.
Thanks