我正在制作一个闪亮的应用程序,用户需要在其中选择表格中的下拉选项。我正在使用 rhandsontable,但是似乎我只能为单个列设置一组下拉选项。所以第 1 行与第 800 行具有相同的选项。我希望第 1 行具有与第 800 行不同的下拉选项集。
有没有办法做到这一点?
我想过创建单独的表格并将它们放在一起看起来像一张桌子。只有第一个表会有列标题,它下面的所有其他表都没有列标题。我试图避免这种情况,因为 rhandsontables 具有水平和垂直滚动条,并且没有办法在多个表之间同步滚动条。那会让“一张桌子”看起来有点不对劲。实际上,将所有数据放在一个表中会更好看且功能更好。
我在下面有一个超级简单的例子:
require(shiny)
require(rhandsontable)
ui <- fluidPage(
hr(""),
# Display table
mainPanel(rHandsontableOutput("ExampleTable"))
)
server <- function(input, output) {
output$ExampleTable <- renderRHandsontable({
# creating table that will be displayed
df <- data.frame(Object = c("car", "car", "car", "house", "house", "house"), Needs = NA, stringsAsFactors = FALSE)
# defining dropdown options
dropdownOptions <- c("tires", "wipers", "headlights", "gutters", "carpet")
rhandsontable(df, rowHeaders = NULL, stretchH = "all") %>%
hot_col("Object", readOnly = TRUE) …Run Code Online (Sandbox Code Playgroud)