change font color on cell value update
change font color on cell value update
prodrive11
Posts: 1Questions: 0Answers: 0
I've made datatables 1.9.4 to get updates via websocket.
What i'm trying to achieve is to change colors of numbers to green or red if they changed respectively.
looked into various examples but looks like I'm not able to get previous value in
mRender, mData... (or i don't know how to, firebug doesn't show prev values in callback parameters)
I've tried to use:
[code]
function rowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
// Bold the grade for all 'A' grade browsers
var sData;
if( oTable ){
sData = oTable.fnGetData(iDisplayIndexFull);
if ( aData[4] > sData[4] )
{
$('td:eq(4)', nRow).html( "" + aData[4].toString() + "" );
}
else if ( aData[4] < sData[4] )
{
$('td:eq(4)', nRow).html( "" + aData[4].toString() + "" );
}
}
}
[/code]
but colors doesn't change in tables.
Any advice ?
EDIT:
I'm really stuck with this, if you think this question is an effect of laziness or low IQ,
could you please at least advise which approach to choose ?
What i'm trying to achieve is to change colors of numbers to green or red if they changed respectively.
looked into various examples but looks like I'm not able to get previous value in
mRender, mData... (or i don't know how to, firebug doesn't show prev values in callback parameters)
I've tried to use:
[code]
function rowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
// Bold the grade for all 'A' grade browsers
var sData;
if( oTable ){
sData = oTable.fnGetData(iDisplayIndexFull);
if ( aData[4] > sData[4] )
{
$('td:eq(4)', nRow).html( "" + aData[4].toString() + "" );
}
else if ( aData[4] < sData[4] )
{
$('td:eq(4)', nRow).html( "" + aData[4].toString() + "" );
}
}
}
[/code]
but colors doesn't change in tables.
Any advice ?
EDIT:
I'm really stuck with this, if you think this question is an effect of laziness or low IQ,
could you please at least advise which approach to choose ?
This discussion has been closed.