Skip to content Skip to sidebar Skip to footer

Datatables - How Do I Change Background And Text Color Of A Cell Changed Dynamically?

I use the following code to update a cell dynamically and works perfect, the only thing is how to change the color of the background and the text of that cell data. If it´s possib

Solution 1:

SOLUTION

You can access the cell node by using cell().node() API method.

$(document).ready(function (){
    var table = $('#example').DataTable();

    table.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
        var cell = table.cell({ row: rowIdx, column: 0 }).node();
        $(cell).addClass('warning');
    });
});

DEMO

See this jsFiddle for code and demonstration.


Post a Comment for "Datatables - How Do I Change Background And Text Color Of A Cell Changed Dynamically?"