小编Shi*_*00B的帖子

Rhandsontable 条件格式 - 如何根据特定属性值突出显示行?

我想根据值对整行应用颜色突出显示,并保留 rhandsontable 的复选框功能。在下面的简单示例中,我希望第 3 行为粉色,第 4 行为绿色。

library(rhandsontable)

DF = data.frame( bool = TRUE,val = 1:10, big = LETTERS[1:10],
                small = letters[1:10],
                stringsAsFactors = FALSE)

###Checkboxes not Present/Entire row not highlighted
rhandsontable(DF, readOnly = FALSE, width = 750, height = 300) %>%
  hot_cols(renderer = "
           function (instance, td, row, col, prop, value, cellProperties) {
           Handsontable.renderers.NumericRenderer.apply(this, arguments);
            if (value == 'C') {
           td.style.background = 'pink';
           } else if (value == 'D') {
           td.style.background = 'green';
           }
           }")

####Checkboxes Present
rhandsontable(DF, readOnly …
Run Code Online (Sandbox Code Playgroud)

javascript r handsontable shiny rhandsontable

2
推荐指数
1
解决办法
2362
查看次数

标签 统计

handsontable ×1

javascript ×1

r ×1

rhandsontable ×1

shiny ×1