why shows " DataTables warning: table id=example1 - Cannot reinitialise DataTable. " error?
why shows " DataTables warning: table id=example1 - Cannot reinitialise DataTable. " error?
munna420
Posts: 1Questions: 1Answers: 0
Error messages shown:
$(function childCategory() {
let table = $('.ytable').DataTable({
processing: true,
serverSide: true,
ajax: "{{route('childcategory.index')}}",
columns: [
{data: 'DT_RowIndex', name: 'DT_RowIndex'},
{data: 'category_name', name: 'category_name'},
{data: 'subcategory_name', name: 'subcategory_name'},
{data: 'childcategory_name', name: 'childcategory_name'},
{data: 'slug', name: 'slug'},
{data: 'action', name: 'action', oderable: true, serchable: true}
]
});
});
Answers
Did you follow the troubleshooting steps at the link in the error?
https://datatables.net/manual/tech-notes/3
My guess is you are calling the function childCategory() more than once and using the class
ytable
to initialize multiple tables which is reinitializing previously initialized Datatables.If you still need help please post a link to your page or a test case replicating the issue so we can see what you have to offer suggestions.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin