table.destroy can not work
table.destroy can not work
YkillM
Posts: 3Questions: 1Answers: 0
when I use table.destroy(),
I get
TypeError: headerCell[i] is undefined
And I can not find out how to deal
emmmm..., I am a Chinese user,so forgive my bad English.
Thanks
This discussion has been closed.
Answers
Hi,
Please post part of your code so that we can see the context.
Thank you!
I am sorry to forget to post my code.And her is my code.
After I get new data,I want to flash the table.
But when it run to
$('#table_id_example').DataTable().destroy();
I get the error.The error and the detail is behind.
TypeError: headerCells[i] is undefined userManage.html:5603:5
_fnCalculateColumnWidths() userManage.html:5603
_fnAdjustColumnSizing() userManage.html:2150
<匿名> userManage.html:8648
.iterator() userManage.html:7029
<匿名> userManage.html:8647
_Api.extend/methodScoping/<() userManage.html:7197
<匿名> userManage.html:8631
_Api.extend/methodScoping/<() userManage.html:7197
<匿名> userManage.html:9300
.iterator() userManage.html:7029
<匿名> userManage.html:9278
_Api.extend/methodScoping/<() userManage.html:7197
init/<.success() userManage.html:50
r.Callbacks/i() userManage.html:2
r.Callbacks/j.fireWith() userManage.html:2
A() userManage.html:4
.send/c/<() userManage.html:4
.send() userManage.html:4
.ajax() userManage.html:4
init() userManage.html:36
.success() userManage.html:187
r.Callbacks/i() userManage.html:2
r.Callbacks/j.fireWith() userManage.html:2
A() userManage.html:4
.send/c/<() userManage.html:4
I know it is to long to read.So thank you a lot!
I think we'd actually need a link to a page showing the issue please.
Allan
Sorry,I can not give you a link to a page because my work computer can not connect to the Internet.
Can you tell me how to debug it or how to find out the way to solve it,maybe I can find the bug by myself.
Thanks a lot!
Are you checking to see if the table was created before you try to destroy it? You will get an error if you try the destroy before creating it.
Use https://datatables.net/reference/api/%24.fn.dataTable.isDataTable() see if the table exists if it returns true, then use the destroy