Changing data-order after initialization?
Changing data-order after initialization?
Neekasa
Posts: 8Questions: 1Answers: 0
Hello :)
I was wondering if there was a way of Re-initializing the sorting after changing a data-order attribute on a table cell?
$('#'+userID).children('td:eq(2)').attr('data-order', statusord);
I use draw()
after but it doesn't seem to do anything.
Thanks for the help!
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I've put a solution in to just
destroy()
the table then re-initialize it, which seems to be working great.Sorry for the brain meltdown (too little sleep is bad...)
destroy()
is the heavy handed approach ;-). It will work, but it is better to simply callrow().invalidate()
. Then when you call draw, or when DataTables next sorts the data, it will read the new value, since the old one has been invalidated. This is far more efficient.Regards,
Allan
Thank you for your response Allan!
It's working wonders, the new API is brilliant, thank you for updating DT so much :)
Fantastic to hear. Thanks for the kind words :-)
Allan