arvinsim arvinsim -4 years ago 209
jQuery Question

Repopulating a Datatable with new parameters

I initialised my table like this

/* POST data to server */
$(document).ready(function() {
$('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "xhr.php",
"fnServerData": function ( sSource, aoData, fnCallback ) {
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
} );
} );
} );

Later on, I want to update the data in the table. How do I do that?

Answer Source

I had the exact same problem, and ended up solving it like this:

function GetDatatable(parameter) {

Then you can add your new parameters in aoData after that. It's an ugly hack, but it works.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download