R Shiny selectize.js item creation

点点圈 提交于 2019-12-11 12:08:48

问题


selectize.js has an item creation option as mentioned on http://brianreavis.github.io/selectize.js/. I'm trying to add the same feature in an R Shiny implementation of selectize but unable to figure out how.

Thanks for your help!

PS: Some more details about what exactly I'm doing - I have some sort of free text vector that I let the user add to. However, I want Shiny to prompt the user with the existing free text values that have previously been added in case the user wants to repeat one of them.


回答1:


All you have to do is to set create option to true:

library(shiny)
shinyApp(
  server = function(input, output, session) {
      observe({ print(input$foo) })
  },
  ui = fluidPage(
    selectizeInput(
       "foo", "foo", c(), selected = NULL, multiple = TRUE,
       options = list(create = TRUE))
  )
)


来源:https://stackoverflow.com/questions/32223770/r-shiny-selectize-js-item-creation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!