Dynamically set className of a column
Dynamically set className of a column
kaushalparik27
Posts: 1Questions: 1Answers: 0
I am trying to hide and show columns without removing it from DOM.
So far, I am able to hide columns first in DataTable initialization. But, I am not able to show columns back via Javascript. Here is what I am trying:
//-- here oTable refers to DataTable. Code is trying to show 5th column by setting a css class that has display: block style
oTable.column(5).className = "show_column";
But, this is not working. Anybody can help?
This discussion has been closed.
Answers
You could try using
column().nodes()
which will give you the cells for the column. You'd also need to usecolumn().header()
andcolumn().footer()
. You'd also need to take account of any rows that are added or dynamically rendered.Why don't you want them removed from the DOM? You can still access the data for them.
Allan