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

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.
You may also like:
- Display SharePoint list data using HTML and jQuery table using Rest API
- Uncaught ReferenceError: web is not defined
- How to display SharePoint list data in an HTML table using JavaScript
Hello Everyone!! I am Bhawana a SharePoint MVP and having about 10+ years of SharePoint experience as well as in .Net technologies. I have worked in all the versions of SharePoint from wss to Office 365. I have good exposure in Customization and Migration using Nintex, Metalogix tools. Now exploring more in SharePoint 2016 🙂 Hope here I can contribute and share my knowledge to the fullest. As I believe “There is no wealth like knowledge and no poverty like ignorance”