我使用两个标签在R Shiny中显示数据框。是否可以在一个选项卡中使用和显示格式化功能,rowCallback和stypeEqual?
datatable(DF, options = list(rowCallback=JS("function(row,data) {
data[0] = data[0] .replace(/NxG/g,'<span style=\"color:blue; font-weight:bold\"\">NxG</span>');
$('td:eq(0)', row).html(data[0] );}"), dom = 't'))
datatable(DF,options = list(columnDefs = list(list(targets = (2:5), visible = FALSE)))) %>% formatStyle(1, 3, backgroundColor =
styleEqual(c(1, 3), c('green', 'yellow')))
答案 0 :(得分:0)
我发现这是一个非常简单的解决方案。
datatable(DF, options = list(rowCallback=JS("function(row,data) {
data[0] = data[0] .replace(/NxG/g,'<span style=\"color:blue; font-weight:bold\"\">NxG</span>');
$('td:eq(0)', row).html(data[0] );}" ), dom = 't')) %>%
formatStyle(1, 3, backgroundColor = styleEqual(c(0, 1, 3), c('lightgreen', 'yellow', 'yellow')))