Tell datatables data in a plain html table has updated

Tell datatables data in a plain html table has updated

ssloanssloan Posts: 4Questions: 0Answers: 0
edited January 2013 in DataTables 1.9
Hi there,

I've already got a fairly complex html table setup, that I update through ajax calls based on user interactions with buttons etc. I've used dataTables to enhance the table, but it doesn't seem to pickup updates to the data for sorting.

I'm initialising the table like this

[code]
$("#studentListTable").dataTable({
"bJQueryUI": true,
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [ 0 ] }
]
});
[/code]

I then want to be able to update the contents of table cells in the dom and have it use the new values for sorting. I've tried calling [code]fnDraw()[/code] afterwards but that didn't make any difference. Are there any methods I can use for this or do I need to integrate the ajax calls with the data tables ajax api?
Thanks.

Replies

  • allanallan Posts: 63,235Questions: 1Answers: 10,417 Site admin
    > do I need to integrate the ajax calls with the data tables ajax api?

    This. There is no DOM mutation API DataTables can listen for (at least not a stable one in all browsers) so you must use the API - http://datatables.net/faqs#append

    Allan
  • ssloanssloan Posts: 4Questions: 0Answers: 0
    OK - thanks for that. Missed that FAQ!
This discussion has been closed.