Highlighting cells red or green after ajax reload

Highlighting cells red or green after ajax reload

grey580grey580 Posts: 1Questions: 1Answers: 0

I have a table setup that is using table.ajax.reload to update it. Which is working fine. but I'd like to highlight cells that have value changed that are up or down. green for up and red for down. but I'm not sure how to go about that.

here's my table code.

<table id="example1" class="display" cellspacing="0" width="100%">
<thead>
        <tr><th>Coin</th><th>last</th><th>lowestAsk</th><th>highestBid</th><th>percentChange</th><th>baseVolume</th><th>quoteVolume</th><th>isFrozen</th><th>high24hr</th><th>low24hr</th></tr>
    </thead>
    <tbody></tbody>
    <tfoot>
        <tr><th>Coin</th><th>last</th><th>lowestAsk</th><th>highestBid</th><th>percentChange</th><th>baseVolume</th><th>quoteVolume</th><th>isFrozen</th><th>high24hr</th><th>low24hr</th></tr>
    </tfoot>
</table>

and the script code.

$(document).ready(function() {
var uriToken = '/update.php';
var table = $('#example1').DataTable( {
    "ajax": uriToken + '?get_ticker2=1',
    "columns": [
        { "data": "Coin" },
        { "data": "last" },
        { "data": "lowestAsk" },
        { "data": "highestBid" },
        { "data": "percentChange" },
        { "data": "baseVolume" },
        { "data": "quoteVolume" },
        { "data": "isFrozen" },
        { "data": "high24hr" },
        { "data": "low24hr" }

} );


window.setInterval( function () {
    table.ajax.reload( null, false ); // user paging is not reset on reload
    //console.log("tick");
}, 3000 );
} );

how can I accomplish this.

This discussion has been closed.