Destroy and create Datatable
Destroy and create Datatable
laloune
Posts: 16Questions: 3Answers: 0
Hello
I have to implement the dynamic columns (I have a list of columns as input, and only those have to be rendered)
I read that the only possibility is to destroy the current datatable, and re-create it, so I read the documentation:
https://datatables.net/reference/api/destroy()
and tried it:
https://jsfiddle.net/jzfuobgd/
but it does not seem to work, I get the error:
Query.Deferred exception: e[i] is undefined"
I might have not understand the documentation correctly ?
tia!
Replies
Your test case has this error:
You first Datatable initialization doesn't have a -tag thead` defined. See the HTML requirements doc for more details. I updated your example here to fix the error:
https://jsfiddle.net/hqapnwue/
I created a
thead
with two columns usingcolumns.title
. I added a button that runs thedestroy()
code.Kevin