Highlighting maximum value in Shiny DataTables -
Highlighting maximum value in Shiny DataTables -
i'm using latest version of shiny including version 1.10.2 of datatables highlight maximum value in selected columns. example
options = list(rowcallback = i( 'function(row, data) { // bold cells >= 5 in first column if (parsefloat(data[0]) >=5) $("td:eq(0)", row).css("font-weight", "bold"); }' )
if necessary, calculate prior values in variable e.g maxcol0 not sure how substitute in hardcoded value, 5 in above code
tia
you utilize paste
add together value of max
in rowcallback
: example, using first 20 lines of mtcars
dataset:
library(shiny) df<-mtcars[1:20,] runapp(list( ui = basicpage( datatableoutput('mytable') ), server = function(input, output) { output$mytable = renderdatatable({ df },options = list(rowcallback = i( paste0('function(row, data) { // bold cells max in first column if (parsefloat(data[0])==',max(df[,1]),') $("td:eq(0)", row).css("font-weight", "bold"); }') ))) }))
datatables shiny
Comments
Post a Comment