Jquery | DataTables warning: table id – Cannot reinitialise DataTable

| By Webner

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
 "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 },

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


  1. i have the same error even after initializing the data-table ones.
    DataTables warning: table id=mainTable – Cannot reinitialise DataTable. For more information about this error, please see http://datatables.net/tn/3

    This the error it brings but after clicking ok the code works but the error message displays whenever i reload the page. Some help pliz.

    $(‘#mainTable’).dataTable( {
    destroy: true,
    paging: false
    } );

  2. destroy: true,

    The retrieve and destroy options are mutually exclusive and cannot be used together (doing so will result in undefined behaviour).

Leave a Reply

Your email address will not be published. Required fields are marked *