How to destroy a datatable?

后端 未结 8 1634
萌比男神i
萌比男神i 2021-02-01 05:19

I\'m using datatables and using bootstrap-daterangepicker to select a range for which data will be shown in Datatables.

It is working fine.

The problem is when I

8条回答
  •  被撕碎了的回忆
    2021-02-01 06:03

    I know this is an old question, but since I bumped into a similar issue and resolved it.

    The following should do the trick (the comments are coming from the DataTable API doc).

    // Quickly and simply clear a table
    $('#feedback-datatable').dataTable().fnClearTable();
    
    // Restore the table to it's original state in the DOM by removing all of DataTables enhancements, alterations to the DOM structure of the table and event listeners
    $('#feedback-datatable').dataTable().fnDestroy();
    

提交回复
热议问题