Change column defs properties, such as width, dynamically after datatable has already been created?
Change column defs properties, such as width, dynamically after datatable has already been created?

I want to be able to switch my table to different layout of columns
Different layout will have different columns visible and different widths.
in table initiation i have set
"autoWidth": false,
and provided it with initial defintion of the default layout of columns
Afterward
I see that I can get a reference to a column as so and change its visibility
var currentColumn = dt.column(strDesiredColumnName+ ":name");
currentColumn .visible(boolDesiredColumnVisibility);
How do I do the same for the column width?
Or if that fails, what's the best way to alter the column definition?
This discussion has been closed.
Answers
If there is an API method for it, then you can change it - e.g. the visibility as you have found. But most do not have such an option and thus cannot be changed after initialisation. You’d need to destroy the existing table and then create a new one with your new preferred options..
Allan