【问题标题】:Keep rhandsontable selected indicator even when there's no focus即使没有焦点,也保持 rhandsontable 选定的指示器
【发布时间】:2021-03-24 19:01:21
【问题描述】:

rhandsontable 在行标题和列标题中使用不同的底纹指示所选单元格,并在所选单元格周围设置边框:

在这里使用第一个表中的示例github site

当我在表格外点击时,它失去焦点,并且那些指示符消失:

即使...$select 的值没有改变。


有没有办法在表格没有焦点的情况下保留这些指标?

【问题讨论】:

    标签: r shiny rhandsontable


    【解决方案1】:

    是的,你可以。 rhandsontable 基于 JS 库 handsontable,因此搜索 handsontable 而不是 rhandsontable 的选项通常很有帮助。根据这个jsfiddle,你需要outsideClickDeselects

    library(shiny)
    library(rhandsontable)
    
    testdf <- data.frame(int = 1:10,
                         numeric = rnorm(10),
                         logical = TRUE,
                         character = LETTERS[1:10],
                         fact = factor(letters[1:10]),
                         date = seq(from = Sys.Date(), by = "days", length.out = 10),
                         stringsAsFactors = FALSE)
    
    ui <- fluidPage(
      rHandsontableOutput("mytable")
    )
    
    server <- function(input, output, session) {
      output$mytable <- renderRHandsontable({
        rhandsontable(testdf,
                      outsideClickDeselects = FALSE)
      })
    }
    
    shinyApp(ui, server)
    

    【讨论】:

      猜你喜欢
      • 2019-10-24
      • 2012-12-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-02
      • 1970-01-01
      相关资源
      最近更新 更多