reorder an initialized table
reorder an initialized table
Teroa
Posts: 9Questions: 3Answers: 0
Hi there,
I've got an easy table with some dates and names.
There is an event to add a new row from another script. Am I able to reorder the current datatable after the new row was appended? Or do I have to re-initialize the table?
Something like $('#table1').DataTable().order()
This discussion has been closed.
Answers
If you us a Datatables API like
row.add()
to add the row Datatables will updated the sorting automatically. If you add the row using Javascript then you will need to have Datatables update its data cache by using something likerows().invalidate()
. The preferred is to use Datatables APIs to add or update rows instead of using the invalidate methods.Kevin
hello kthorngren,
thank you very much. I will test the add-api, if it's fitting my needs, then I will use it. If not I will try to invalidate().