0

Here is my code for a very basic shiny app. It of requires the packages shiny as well as the shinysky library from github: https://github.com/AnalytixWare/ShinySky

Here is a reproducible example:

 testing <- function() {
  shinyApp(ui = fluidPage(
   sidebarLayout(
    sidebarPanel(
      select2Input("select2Input3",
                   "Multiple Select 2 Input",
                   choices = c("a","b","c"),
                   selected = c("b","a"), 
                   type = "select")  
      ),mainPanel(
        ))
  ), server = function(input, output){})
}

testing()

I am confused as to why even though I have choices as c("a", "b", "c"), the dropdown will only select b and have no other choices. I have also tried just selected = "b", but with no luck. I looked at the examples for shiny sky and I can't see what I am missing. The video tutorial showed the same type of dropdown but had "b" selected, yet the user could also click on "a" or "c" in the dropdown: https://www.youtube.com/watch?feature=player_embedded&v=9T4F-j76Vf0&noredirect=1

I may be missing something obvious, but I can't seem to find it right now. Thank you!

Monica Heddneck
  • 2,973
  • 10
  • 55
  • 89
johnny838
  • 922
  • 7
  • 15

1 Answers1

1

You have to add the parameter "multiple" in your select2Input and set it to TRUE (like it is in the video). It is FALSE by default.

select2Input("select2Input3",
               "Multiple Select 2 Input",
               choices = c("a","b","c"),
               selected = c("b","a"), 
               type = "select",
               multiple=TRUE)

Edit: it doesn't work for me either. The select2Input may need an update. His exemple shinysky::run.shinysky.example() don't work anymore for Select2.

sechstein
  • 305
  • 2
  • 9
  • It still does not have the intended behavior. When I try to type "c", I get no match is found, and I didn't set multiple to TRUE because the video link I posted said if you wanted the dropdown to not have multiple be TRUE. I am just puzzled why the video's version works when mine is the exact same and does not work. – johnny838 Jul 14 '15 at 17:28
  • 1
    Yes you are right, only the first of the three examples work for me too. But you can use the original selectInput from shiny. – sechstein Jul 15 '15 at 17:04
  • Thanks for the feedback. I ended up using selectize input, but now I am trying to use the text.typeahead in shiny sky because that is more what I want. I'm going to take a closer look. – johnny838 Jul 16 '15 at 12:13