I am updating my table using ajax, the process is not tied to the datatables and I would like to perform a table refresh
$('#listing').dataTable( {
"bDestroy": true,
"bProcessing": true,
"sAjaxSource": "getlist/",
"bJQueryUI": true,
"aoColumns": [
{ "mDataProp": "id" },
{ "mDataProp": "aname" },
{ "mDataProp": "acode" },
{ "mDataProp": "editlink" },
{ "mDataProp": "deletelink" },
],
"aoColumnDefs": [
{ "bSearchable": false, "bVisible": false, "aTargets": [ 0 ] }
]
} );
My data is customized to appear as {"aaData":[{"id":"14", and its working well because the table is being rendered.
You can update the datatable by calling
fnDraw()method. However the Datatables will read the data again from the actual data source (Ajax URI, in your case) ONLY ifbServerSide: trueis set (by which you are telling the Datatables that all the processing is done at server side).One side effect of
bServerSide: trueis that you need send the pagination details (iTotalRecords & iTotalDisplayRecords, .. ) & other data in the Ajax response (see Server-side Processing docs).Othre side effect is that filtering will not work any longer 🙁 Datatable can’t filter the partial data which it has.