rstudio / shiny

Easy interactive web applications with R
https://shiny.posit.co/
Other
5.37k stars 1.87k forks source link

selectizeInput ( ... , multiple = FALSE) does not work #3297

Open shambhu112 opened 3 years ago

shambhu112 commented 3 years ago

Problem : in selectizeInput(multiple = FALSE) does not work

Refer Code and screenshot below

Code

library(shiny)

opts <- sapply(1:100000, function(i) paste0(sample(letters, 7), collapse=""))

shinyApp(
  ui = fluidPage(
    fluidRow(
      column(3,
             selectizeInput("banks_hqs", " Select Bank",
                            choices = NULL,
                            selected = NULL,
                            options = list(maxItems = 30, placeholder = "Enter bank name .. "),
                            multiple = FALSE,
                            width = "300"
             )
      ), column(3,
                tags$label("Value:"), verbatimTextOutput("val1", placeholder = TRUE),
      )
    )
  ),
  server = function(input, output , session) {
    updateSelectizeInput(session, "banks_hqs",
                         choices = opts,
                         selected = NULL,
                         server = TRUE,
                         options = list(maxItems = 30, placeholder = "enter a bank.. ")
    )

  }
)

Screenshot

image

Output of sessionInfo():

image

cpsievert commented 3 years ago

It's not clear to me what you mean by doesn't work. The selectInput() appears to work fine -- are you expecting verbatimTextOutput("val1", placeholder = TRUE) to update somehow? You don't have any server-side code to populate that output here.

Closing since https://community.rstudio.com/ would be a more appropriate forum for this discussion.

shambhu112 commented 3 years ago

When I type multiple = false. Should I not expect to just select 1 item from drop down. I am able to select multiple selections even when multiple is set to false .