updating data-order in html
updating data-order in html
Hi
I have a table that is updated via html. This is working as im calling dt.rows().invalidate().draw()
as an update event.
I have now added that i update the class of a TD and also the data-order on the same TD. The class change is reflected fine as I can see the new class redered on the screen.
My rows on the other hand does not re-order according to the new data-order.
The ordering given in the config works initially and will again reorder if i do a full page reload.
Any pointers to what i could be missing here?
Thanks
Jens
Answers
How are you updating the
data-order
attribute?You need to use `jQuery attr() instead of jQuery data() to update the DOM for Datatables to use. From the jQuery data() docs
If this doesn't help please provide a link to your page or a test case replicating the issue so we can help debug.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
If you update the attribute, you would also need to call
row().invalidate()
to have DataTables update its cache of the data.Allan