How to change the background color or a Table cell depending on other column value in Jquery Datatab
How to change the background color or a Table cell depending on other column value in Jquery Datatab
krn1231
Posts: 9Questions: 4Answers: 0
How to change the background color or a Table cell depending on other column value in Jquery Datatable ??
In this fiddle http://jsfiddle.net/5fbo72rm/4/
The table has got three coulmns Name ,Price and Quantity .
How can i change the background color of that Name cell if the quantity is greater than 40000
<table id="allwl">
<th class="hidden-480">Price</th>
<th class="hidden-480">Volume</th>
<th class="hidden-480">Quantity</th>
</table>
var dataSet = [
[
"1441.75",
"100"],
[
"1614.45",
"50"
],
[
"834.15",
"3000"]
];
var array_names = ["APPLE", "WHIRLPOOL", "SAMSUNG"];
for (var key in dataSet) {
if (dataSet.hasOwnProperty(key)) {
dataSet[key].splice(0, 0, array_names[key]);
}
}
$(function () {
$('#allwl').dataTable({
"iDisplayLength": -1,
"data": dataSet,
"columns": [{
"title": "Name"
}, {
"title": "Price"
}, {
"title": "Quantity"
}]
});
})
I have tried with createdcell , but that is only working with that particuarlar cell ,not for other cell
Could anybody please help me ,how to resolve this ??
This discussion has been closed.