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.
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:
- if the option “save a list as template” is missing on the list settings. it is most probably because
- Your organization needs more information to keep your account secure
- Server relative URLs must start with spweb.serverrelativeurl in SharePoint
- http error 400. the size of the request headers is too long
- Error=Value=QuotaExceeded in SharePoint
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com