User initiated refresh
User initiated refresh
I have a table of records that I'm loading from a WCF service that is returning json. I'm using fnServerData to customize the data into the aaData structure needed by DataTables. That is working just great.
What I would like to do is have the either a timer or a user refresh the data on request. (basically monitoring a bunch of objects in a server application)
Earlier discussions referred to a fnAjaxRefesh() method. I can't find that in the current release. Has it been removed? What approach would accomplish what I'm looking for?
Here is what I have currently:
[code]
var solutionTable;
$(document).ready(function() {
solutionTable = $('#solutions').dataTable({
"aoColumns": [
{ "sClass": "center img_open", "bSortable": false },
null,
null,
null,
null,
null,
null,
null,
null,
],
"iDisplayLength": 5,
"bJQueryUI": true,
"bAutoWidth": false,
"bProcessing": true,
"sAjaxSource": 'http://localhost/MyWeb/AppControl.svc/si-dev/solutions',
"fnServerData": function(sSource, aoData, fnCallback) {
$.ajax({
"dataType": "json",
"type": "GET",
"url": sSource,
"success": function(data, textStatus) {
var aaData = { "aaData": [] };
for (i in data) {
aaData.aaData.push(
[
'',
data[i].Name,
data[i].Enabled.toString(),
data[i].LastMessageAt,
data[i].Received,
data[i].Queued,
data[i].InFlight,
data[i].Held,
data[i].Processed
]
);
}
fnCallback(aaData);
}
});
}
}); //dataTable init
[/code]
What I would like to do is have the either a timer or a user refresh the data on request. (basically monitoring a bunch of objects in a server application)
Earlier discussions referred to a fnAjaxRefesh() method. I can't find that in the current release. Has it been removed? What approach would accomplish what I'm looking for?
Here is what I have currently:
[code]
var solutionTable;
$(document).ready(function() {
solutionTable = $('#solutions').dataTable({
"aoColumns": [
{ "sClass": "center img_open", "bSortable": false },
null,
null,
null,
null,
null,
null,
null,
null,
],
"iDisplayLength": 5,
"bJQueryUI": true,
"bAutoWidth": false,
"bProcessing": true,
"sAjaxSource": 'http://localhost/MyWeb/AppControl.svc/si-dev/solutions',
"fnServerData": function(sSource, aoData, fnCallback) {
$.ajax({
"dataType": "json",
"type": "GET",
"url": sSource,
"success": function(data, textStatus) {
var aaData = { "aaData": [] };
for (i in data) {
aaData.aaData.push(
[
'',
data[i].Name,
data[i].Enabled.toString(),
data[i].LastMessageAt,
data[i].Received,
data[i].Queued,
data[i].InFlight,
data[i].Held,
data[i].Processed
]
);
}
fnCallback(aaData);
}
});
}
}); //dataTable init
[/code]
This discussion has been closed.
Replies