Reputation: 26044
I want to manually set a DataTable option after it has been initialised, for example:
var myTable = $("#selector").DataTable({
"stateSave": false
});
I want to be able to switch the 'stateSave' option to true - how would I do this?
p.s. I'm using the DataTables 1.10.0
Upvotes: 0
Views: 1228
Reputation: 2156
From the datatables documentation:
Simply put, DataTables does not allow initialisation options to be altered at any time other than at initialisation time. Any manipulation of the table after initialisation must be done through the API and trying to set the initialisation options once the table has already been initialised will result in the error.
However for your sample with stateSave
you could destroy the table and reinitalize it.
$("#testButton").click(function () {
myTable.destroy();
myTable = $('#selector').DataTable({ stateSave: true});
});
Upvotes: 1