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

前端 未结 13 1347
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-04 15:07

I am working with datatables example and getting an error like this when loading page: Datatables warning(table id = \'example\'): cannot reinitialise data table. To retriev

13条回答
  •  -上瘾入骨i
    2020-12-04 15:38

    This problem occurs if we initialize dataTable more than once.Then we have to remove the previous.

    On the other hand we can destroy the old datatable in this way also before creating the new datatable use the following code :

    $(“#example”).dataTable().fnDestroy();
    

    There is an another scenario ,say you send more than one ajax request which response will access same table in same template then we will get error also.In this case fnDestroy method doesn’t work properly because you don’t know which response comes first or later.Then you have to set bRetrieve TRUE in data table configuration.That’s it.

    This is My senario:

    
    

提交回复
热议问题