Hide empty columns
Hide empty columns

Hi,
I would appreciate it if anyone could help me. I'd like to automatically hide all columns that has no data when using responsive datatable. Thanks !!!
This discussion has been closed.
Hi,
I would appreciate it if anyone could help me. I'd like to automatically hide all columns that has no data when using responsive datatable. Thanks !!!
Answers
The best way to do it would be in
initComplete
. Cycle through the columns withcolumns().every()
, get the data withcolumn().data().unique()
, and if there's a single item which is empty, callcolumn().visible()
,Colin
Nice one Colin. Thanks for your help!