我使用 selectizeInput 来获得可自动完成的单词列表,如下面的应用程序所示。
server <- function(input, output) {
output$word <- renderText({
input$selInp
})
}
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
selectizeInput('selInp', label ='',
selected = 'like',
choices = c('like','eat','apples','bananas'))
),
textOutput('word')
)
)
shinyApp(ui = ui, server = server)
我想做的就是接受与选择
不匹配的输出。因此,如果我写“orange”,我希望能够在 textOutput
中显示它。有没有办法告诉 selectizeInput
对于它所需要的输入不要那么有选择性?
最佳答案
我相信您正在寻找创建
选项:
library(shiny)
server <- function(input, output) {
output$word <- renderText({
input$selInp
})
}
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
selectizeInput('selInp', label ='',
selected = 'like',
options = list('create' = TRUE),
choices = c('like','eat','apples','bananas'))
),
textOutput('word')
)
)
shinyApp(ui = ui, server = server)
关于javascript - 从 selectizeInput 获取不完整的输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43332776/