I am currently utilizing the datatables plugin in my project.
One of the columns in my table is named "CSS" and it contains CSS code for styling the columns in that row.
For example, the table structure in the database looks like this:
Name Priority Percent CSS
---------------------------------------------------------
abc high 50 .priority{color:red} .percent {color:yellow}
xyz low 70 .priority{color:green} .percent {color:green}
pqr medium 10 .priority{color:yellow} .percent {color:red}
When displaying the datatable, I do not want to show the "CSS" column but still want to apply the styles to specific cells. I am trying to achieve something similar to the following:
$('#example').dataTable({
"fnRowCallback": function (nRow, aData, iDisplayIndex, iDisplayIndexFull) {
$(row).children().each(function(index, td){
// implement operation here
});
return nRow;
}
I am unsure about how to add CSS for a particular <td>
element using the CSS from another <td>
in the same row.
Your assistance in this matter would be greatly appreciated.