comparing values and update?
comparing values and update?
hey,
i got a list with prices. when a price changes the table gets updated with fnAjaxReload
how can i compare the updated value with the old one?
i tried fnRowCallback but the 'old_value' is always the new one..
my code:
[code]
var oTable = $('#table').dataTable(
{
"sAjaxSource" : "http://192.168.100.163:8888/datatables",
"iDisplayLength" : 2,
"bProcessing": true,
"bServerSide": true,
"bSort": true,
"bInfo": true,
"bPaginate": true,
"bLengthChange": false,
"bStateSave": false, //true for save location
"bFilter": false,
"bAutoWidth": false,
"aaSorting": [[ 4, "desc" ], [ 5, "asc" ]],
"oLanguage": { "sProcessing": "" },
"aoColumnDefs":
[
{ "bVisible": false, "aTargets": [0] },
{ "bVisible": false, "aTargets": [1] },
{ "bVisible": false, "aTargets": [2] },
{ "bVisible": false, "aTargets": [3] },
{ "bVisible": true, "aTargets": [4] },
{ "bVisible": true, "aTargets": [5] },
{ "bVisible": false, "aTargets": [6] },
{ "bVisible": true, "aTargets": [7] }
],
"fnRowCallback": function(nRow, aData, iDisplayIndex, iDisplayIndexFull)
{
var old_value = $('td:eq(1)', nRow).html();
var new_value = aData[5];
console.log('old value: '+old_value);
console.log('new value: '+new_value);
if (old_value > new_value) { console.log("bigger"); }
if (old_value < new_value) { console.log("smaller"); }
if (old_value == new_value) { console.log("same"); }
}
});
setInterval(function() { oTable.fnReloadAjax(); },5000);
[/code]
thanks in advance,
mosstrau
i got a list with prices. when a price changes the table gets updated with fnAjaxReload
how can i compare the updated value with the old one?
i tried fnRowCallback but the 'old_value' is always the new one..
my code:
[code]
var oTable = $('#table').dataTable(
{
"sAjaxSource" : "http://192.168.100.163:8888/datatables",
"iDisplayLength" : 2,
"bProcessing": true,
"bServerSide": true,
"bSort": true,
"bInfo": true,
"bPaginate": true,
"bLengthChange": false,
"bStateSave": false, //true for save location
"bFilter": false,
"bAutoWidth": false,
"aaSorting": [[ 4, "desc" ], [ 5, "asc" ]],
"oLanguage": { "sProcessing": "" },
"aoColumnDefs":
[
{ "bVisible": false, "aTargets": [0] },
{ "bVisible": false, "aTargets": [1] },
{ "bVisible": false, "aTargets": [2] },
{ "bVisible": false, "aTargets": [3] },
{ "bVisible": true, "aTargets": [4] },
{ "bVisible": true, "aTargets": [5] },
{ "bVisible": false, "aTargets": [6] },
{ "bVisible": true, "aTargets": [7] }
],
"fnRowCallback": function(nRow, aData, iDisplayIndex, iDisplayIndexFull)
{
var old_value = $('td:eq(1)', nRow).html();
var new_value = aData[5];
console.log('old value: '+old_value);
console.log('new value: '+new_value);
if (old_value > new_value) { console.log("bigger"); }
if (old_value < new_value) { console.log("smaller"); }
if (old_value == new_value) { console.log("same"); }
}
});
setInterval(function() { oTable.fnReloadAjax(); },5000);
[/code]
thanks in advance,
mosstrau
This discussion has been closed.
Replies
Allan
i have no idea what to modify inside fnReloadAjax :(
i just wanna compare the old value with the updated one and highlight the row..
i love datatables but i will need to search for some other table plugin that supports such a function..
greetz,
mosstrau