Table Refresh
Table Refresh
xplosiv166
Posts: 1Questions: 0Answers: 0
Hi,
I have the following code which populates the data table on page load:
[code]
_oTable = $('#example').dataTable({
"bJQueryUI": true,
"bProcessing": true,
"sAjaxSource": "Map/GetRequests",
"bDeferRender": true,
"fnServerData": function (sSource, aoData, fnCallback) {
alert("Get data");
$.ajax({
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
});
},
"aoColumns": [
{ "mDataProp": "ID" },
{ "mDataProp": "Name" },
{ "mDataProp": "Text" },
{ "mDataProp": "Carrier" },
{ "mDataProp": "DeliveryReport" },
{ "mDataProp": "Response" },
{ "mDataProp": "TimeDate" },
],
"aaSorting": [
[0, "desc"]
],
"fnInitComplete": function (oSettings, json) {
$(_oTable)._toggleClass("hide");
}
});
[/code]
I need to refresh the table every 10 seconds, i have tried using a timer and calling : -
[code]
if (_oTable != null) {
_oTable.fnClearTable();
_oTable.fnReloadAjax();
}
[/code]
All the above code does it clear the table, how can i make the table do my "fnServerData" call again?
Thanks for your time,
Andy
I have the following code which populates the data table on page load:
[code]
_oTable = $('#example').dataTable({
"bJQueryUI": true,
"bProcessing": true,
"sAjaxSource": "Map/GetRequests",
"bDeferRender": true,
"fnServerData": function (sSource, aoData, fnCallback) {
alert("Get data");
$.ajax({
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
});
},
"aoColumns": [
{ "mDataProp": "ID" },
{ "mDataProp": "Name" },
{ "mDataProp": "Text" },
{ "mDataProp": "Carrier" },
{ "mDataProp": "DeliveryReport" },
{ "mDataProp": "Response" },
{ "mDataProp": "TimeDate" },
],
"aaSorting": [
[0, "desc"]
],
"fnInitComplete": function (oSettings, json) {
$(_oTable)._toggleClass("hide");
}
});
[/code]
I need to refresh the table every 10 seconds, i have tried using a timer and calling : -
[code]
if (_oTable != null) {
_oTable.fnClearTable();
_oTable.fnReloadAjax();
}
[/code]
All the above code does it clear the table, how can i make the table do my "fnServerData" call again?
Thanks for your time,
Andy
This discussion has been closed.