【发布时间】:2018-09-13 14:10:34
【问题描述】:
我正在尝试在 R Shiny 中构建一个应用程序,我正在使用手动操作表来获取用户的输入。我的handsontable 中的一列有下拉列表,我需要用户进行多项选择。
例如,在我下面的示例代码中,我希望允许用户在“大”列中选择多个值(即用户应该能够为第一行选择 A、B、C,对于其他行也是如此)
library(shiny)
library(rhandsontable)
shinyApp(
ui = fluidPage(
fluidRow(
column(12,
sliderInput('input', label = "Rows",
min = 1, max = nrow(iris), value = 10)
),
column(12
,
rHandsontableOutput('table')
)
)
),
server = function(input, output) {
DF = data.frame(val = 1:10, bool = TRUE, big = LETTERS[1:10],
small = letters[1:10],
dt = seq(from = Sys.Date(), by = "days", length.out = 10),
stringsAsFactors = FALSE)
# try updating big to a value not in the dropdown
output$table <- renderRHandsontable(
rhandsontable(DF, rowHeaders = NULL, width = 550, height = 300) %>%
hot_col(col = "big", type = "dropdown", source = LETTERS) %>%
hot_col(col = "small", type = "autocomplete", source = letters,
strict = FALSE)
)
}
)
如果有人遇到同样的问题并解决了同样的问题,请告诉我。
【问题讨论】:
标签: drop-down-menu shiny multi-select handsontable rhandsontable