Rhandsontable 中的粘性列和行名称

问题描述 投票:0回答:1

我目前正在开发一个闪亮的应用程序,我使用

rhandsontable
包来显示表格。这是我正在使用的代码:

library(shiny)
library(rhandsontable)

ui <- fluidPage(
  mainPanel(
    rHandsontableOutput("myTable")
  )
)

server <- function(input, output) {
  output$myTable <- renderRHandsontable({
    df <- data.frame(matrix(1:(50**2), ncol = 50))
    rhandsontable(df, height = 10000, width = 10000)
  })
}

shinyApp(ui = ui, server = server)

我想要有粘性的列和行名称,但我不确定如何在不使用框的情况下实现此目的(这就是为什么我设置了非常大的height

width
)。我尝试了几种方法,但似乎都不起作用。任何意见都会被采纳。

javascript r handsontable rhandsontable
1个回答
0
投票
此示例在 rhandsontable 调用中使用 hot_table 函数使行名称粘性 (stickyRows = TRUE) 并包含列标题

(colHeaders = TRUE) library(shiny) library(rhandsontable) ui <- fluidPage( mainPanel( rHandsontableOutput("myTable") ) ) server <- function(input, output) { output$myTable <- renderRHandsontable({ df <- data.frame(matrix(1:(50**2), ncol = 50)) rhandsontable(df, height = 500, width = 800) %>% hot_table(stickyRows = TRUE, colHeaders = TRUE) }) } shinyApp(ui = ui, server = server)
    
© www.soinside.com 2019 - 2024. All rights reserved.