How to apply styling to a column value based on another column value?
How to apply styling to a column value based on another column value?
vaishnavkoka
Posts: 132Questions: 23Answers: 1
I tried but unable to reach to that point
ex: if the "office" value ===''Tokyo'' then its position value i.e., text should be changed to 'red' color (wherever tokyo is found its relevant position should be changed to red)
I tried using columnDef,rowcallback method but it didnt workout for me.
Thanks
Koka
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You could use
rowCallback
,createdRow
orcolumns.createdCell
. Here is an example:http://live.datatables.net/sonirusa/1/edit
Kevin
It doesn't work out when i tried, though it works on live datatable links
`
$(document).ready(function() {
var table= $('#file_tracking').DataTable( {
// var pagination = $("#file_tracking").find(".pagination");
// pagination.find('li').css("padding","0");
// pagination.parent().css({"float":"none","text-align":"center"});
// pagination.parent().parent().removeClass("col-md-7");
// $(".dataTables_length").find("select").css({"padding-top":"2px","height":"25px"});
// alert( 'DataTables has finished its initialisation.' );
} );
} );`
Thanks
Koka
You are using
columns.data
which means your data is contained in objects not arrays. In yourrowCallback
you are trying to use arrays. Change the code to this:Kevin