cannot reinitialise datatable

    In this tutorial, we will discuss how to fix the error, Datatables warning(table id = ‘example’): cannot reinitialise data table.

    Datatables warning(table id = ‘example’): cannot reinitialise data table

    The error came while I was trying to retrieve more than 5000 items using Rest API from a SharePoint Online list and was trying to bind the data to DataTables.

    Here, I was using the code below:

    $('#Employee').DataTable({
    	"aaData": response,
    	"aoColumns": [
    	{
    	"mData": "Title"
    	}
    	]
    	});

    But it gave the error when I tried to execute the code. It gave error as:

    DataTables warning: table id=Employee – Cannot reinitialise DataTable. For more information about this error, please see http://datatables.net/tn/3

    cannot reinitialise data table

    To fix the error, you need to add the below attribute.

    "bDestroy": true

    It will look like below:

    $('#Employee').DataTable({
    	"aaData": response,
    	"bDestroy": true,
    	"aoColumns": [
    	{
    	"mData": "Title"
    	}
    	]
    	});

    After this, the error did not come; this fixes the issue Datatables warning(table id = ‘example’): cannot reinitialise data table.

    I hope this solution will help you to fix the error, datatables warning: table id=example – cannot reinitialise datatable. for more information about this error.

    You may also like:

    comment_count comments
    Oldest
    Newest
    Oldest

    Comment as a guest:

    >