Column name in dynamic table stay permanenently

Column name in dynamic table stay permanenently

tsurubasotsurubaso Posts: 32Questions: 8Answers: 0

code part :
https://pastebin.com/7WLY5t6v
Visuals to understand the problem:

Debugger code (debug.datatables.net):
Error messages shown:
There is no alert or error message

Description of problem:

From the code, the column name should be erase and reinitialized but they stay.
I am new to datatables, I have surely missed something.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,139Questions: 26Answers: 4,734
    edited October 2021 Answer ✓

    Looks like you need to include a call to jQuery empty(). See the second example in the destroy() docs.

    Kevin

  • tsurubasotsurubaso Posts: 32Questions: 8Answers: 0

    @kthorngren Thanks, I will check your answer!!!

  • tsurubasotsurubaso Posts: 32Questions: 8Answers: 0
    edited October 2021
    if ($.fn.DataTable.isDataTable('#searchTable')) {
    
        $('#searchTable').DataTable().clear().destroy();
        $('#searchTable').empty();
     }
    

    Made it work,
    super thanks

Sign In or Register to comment.