I have the code shared below. I have multiple tabs one of which has a selectizeInput that contains a list of 50,000 unique values. Hence, as suggested here https://shiny.rstudio.com/articles/selectize.html I use it server side. For some reasons, the page Dashboard 2 that contains the selectizeInput element doesn't react. The field is empty no matter what I type in there. My code is structured using different R files given my really big shiny app. However, in order to replicate the problem, two files are all you need. The first file is called "app.R" and contains the following code:
ui <- dashboardPage(
title = "Title test",
dashboardHeader(title = "Dashboard header"),
dashboardSidebar(
includeCSS("www/styles.css"),
sidebarMenu(
menuItem('Retail1', tabName = "tab1", icon = icon("th"),
menuItem('Dashboard2', tabName = 'retail_dashboard1')
),
menuItem('Retail2', tabName = "tab2", icon = icon("th"),
menuItem('Dashboard2', tabName = 'retail_dashboard2')
)
)
),
dashboardBody(
tabItems(
tabItem(tabName = "retail_dashboard2",
uiOutput("ui_retail_dashboard2") )
)
)
)
server <- function(input, output, session) {
source("Page_retail_dash2.R", local=T)
shiny::updateSelectizeInput(session=session, inputId ='element_with_list_of_cities', choices = rownames(mtcars), server = TRUE )
}
cat("\nLaunching 'shinyApp' ....")
shinyApp(ui, server)
The second file is called "Page_retail_dash2.R" and contains the following simple code:
output$ui_retail_dashboard3 <- renderUI({
tabsetPanel(type = "tabs",
tabPanel("Dashboard 3",
h3("Test"),
fluidRow(
column(2,
selectizeInput(inputId = "element_with_list_of_cities_dash3",
label = "Cities",
choices = NULL,
selected = NULL,
multiple = TRUE # allow for multiple inputs
,options = list(create = FALSE, maxOptions = 1000) # if TRUE, allows newly created inputs))
))
)
)
)
})
If you simply copy and paste my code, you should be able to replicate the issue. I also attach here what I see my I run my app.
You may ask why the first tab is empty. In my app it's not empty, it has some tables but you don't need it in order to replicate this issue.