If you try to set properties of Jquery datatable 2 times as below, it will give an error:

table = $('#product-data-table').DataTable({stateSave: true}) ;

table = $('#product-data-table').DataTable
({"aoColumns": 
 [
  {
 "bSortable": false },null,null,null
  ]
 });

“DataTables warning: table id=product-data-table – Cannot reinitialise DataTable”.

DataTables does not allow initialization options to be altered at any time other than at initialization time. Any manipulation of the table after initialization must be done through the API and trying to set the initialization options once the table has already been initialized will result in the above error.
Solution is to set all the properties at initialisation time as follows:

table = $('#product-data-table').DataTable
        ({
        stateSave: true,
        "aoColumns": [
                      { "bSortable": false },
                      null,
                      null,
                      null
                      ]
        });

Webner Solutions is a Software Development company focused on developing CRM apps (Salesforce, Zoho), LMS Apps (Moodle/Totara), Websites and Mobile apps. If you need Web development or any other software development assistance please contact us at webdevelopment@webners.com