I'm creating a dataTable that has a user-defined number of rows & columns. I would like to loop through all of the cells in the table (minus the first column, which contains names) and highlight/change CSS if values are greater than 10. Shiny has a great example of targeting a specific column (see below). I'm assuming I'd need to write some sort of jQuery function? I'm a complete jQuery newbie, so I gave it a try, and, it obviously hasn't worked (also see below). Any help would be greatly appreciated!
Shiny example of targeting a specific column:
rowCallback = I(
'function(row, data) {
// Bold cells for those >= 5 in the first column
if (parseFloat(data[0]) >= 5.0)
$("td:eq(0)", row).css("font-weight", "bold");
}'
)
My failed attempt at writing a function to loop through cells:
rowCallback = I('
function(row, data) {
for each (i in 1:1000) {
if (parseFloat(data[i]) > 10.0)
$("td:eq(i)", row).css("color", "red");}
}')