How i remove columns and recreate datatable

How i remove columns and recreate datatable

theppiwattheppiwat Posts: 6Questions: 2Answers: 0

i try to remove columns by use destroy() function but not working it's does not remove old columns

example
First
columns = [id,name,point1,point2]

But when i destroy and try to recreate to

Second
columns=[id,name,point1,point2,point3,point4]

i got old columns mix with new column like this
columns = [id,name,point1,point2,point3,point4,point1,point2]
it's should be like columns=[id,name,point1,point2,point3,point4] (Second)
how i fix it?

Answers

  • kthorngrenkthorngren Posts: 21,167Questions: 26Answers: 4,921

    I think you will need to use [jQuery empty()] on the table to remove the old header. Use it after you use destroy() then append the new header or use columns.title to add the header.

    Kevin

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    You can also ColReorder - that might do the trick

    Colin

This discussion has been closed.