live event to replace table contents every 10 secs - example somewhere?
live event to replace table contents every 10 secs - example somewhere?
version 1.94, I've searched around but nothing really jumped out at me for this, but I think I'm overthinking this
We have a stream of data, similar in nature to an RSS feed, that hits our site continuously and is fed into a table.
I'm putting a dashboard-like page together for the UI front end and I'd like to add a single column table that shows the last 20 items that have come in from the RSS-like feed that refreshes every 10 seconds. I've got the server side call written that returns the last 20 items, and I'd just replace the entire contents of the table with the new data every 10 in hopes of keeping it simple.
Is there an example somewhere of the live updating that someone that someone could point me to that would get me in the ballpark?
tia
We have a stream of data, similar in nature to an RSS feed, that hits our site continuously and is fed into a table.
I'm putting a dashboard-like page together for the UI front end and I'd like to add a single column table that shows the last 20 items that have come in from the RSS-like feed that refreshes every 10 seconds. I've got the server side call written that returns the last 20 items, and I'd just replace the entire contents of the table with the new data every 10 in hopes of keeping it simple.
Is there an example somewhere of the live updating that someone that someone could point me to that would get me in the ballpark?
tia
This discussion has been closed.
Replies
I'm thinking about a similar scenario as you, where I'd like to auto-refresh my Datatable from time to time (and perhaps make it user-configurable).
good luck.
'sAjaxSource': src= someurl
this is the closest I've been able to find so far: http://datatables.net/forums/discussion/6650/server-side-auto-refresh-table/p1
think the answer to my question is in there somewhere, just need to rework the code to my direction
will post my solution if it ends up being different somehow
Allan gave me a great idea this week in terms of refreshing, except it was based on a change event on a dropdown list I implemented. So I'm using fnAddData() after I init the Datatable.
Perhaps this could be used on a timer as well...
ex/
If my datatable is already initialized, then use fnAddData();
[code]
var PfJsonData = [];
$(this).find("id").each(function (){
PfJsonData.push({"Term": term, "Exposure": exposure });
}
if (oTablePf_Initialized == false) {
oTablePf = $('#pftable').dataTable({ // INIT
"aaData": PfJsonData,
});
oTablePf_Initialized = true;
}
else { // CLEAR TABLE AND REPOPULATE
oTablePf.fnClearTable();
if (oTableCo_Initialized) {
oTableCo.fnClearTable();
}
oTablePf.fnAddData(PfJsonData, true);
}
[/code]