Shiny UI Output dependent filters does not fully work

I am having issue with dependent filters. The first two filters show up on the drop down list but

the other two do not. The two drop down filters that do not show up are the Branch filters and the

FinMode filter or the mode filter

Please any assistances or guidance will be greatly

appreciated.

Thank you!

This is my code below:

ui <- dashboardPage(
  
  ## Sidebar content
  dashboardSidebar(
    sidebarMenu(
  
      uiOutput("select_Month"), 
      uiOutput("select_Region"),
      uiOutput("select_Branch"),
      uiOutput("select_Mode"))) )


server <- function(input, output, session) {
  ##Connections
  First_DF <- read.csv(file = "~/SamplePostgressData.csv" , stringsAsFactors = FALSE) 

First_DFCumeReactive <- reactive({
    First_DF  %>% 
      filter(Month %in%  input$monthSel)  %>%
      filter(Region %in% input$selRegion) %>%
      filter(Branch %in% input$selBranch) %>%
      filter(FinMode %in% input$selMode)  %>%
      group_by(Year, Month,Day) %>%
      mutate(cumeNR = cumsum(NR)) %>%
      merge(First_DF %>%
              group_by(Year, Month) %>%
              mutate(cumeFC = cumsum(FC)),
            by=c('Year', 'Month', 'Day', 'NR', 'FC')) %>%
      arrange(Year, Month, Day)  
  }
  )  
  
  
  #### SidebarMenu  ###  Selectors set-up
  
  output$select_Month <- renderUI({ 
    
    selectizeInput(label='Month',
                   inputId='monthSel',
                   choices=  c("select" = "", unique(First_DF$Month )) 
    )
  })
  
  
  
  #Choice_Region 
  choice_Region <- reactive({
    First_DF %>%  
      filter(Month %in%  input$monthSel) %>% 
      distinct(Region) %>% pull() %>%
      as.character()
  })
  
  
  
  
  
  output$select_Region <- renderUI({
    
    selectizeInput(label='Region',
                   inputId='selRegion',
                   choices= choice_Region() )
    
  })
  
  #Choice_Branch
  
  choice_Branch <- reactive({
    First_DF %>% 
      filter(Month %in%  input$monthSel) %>% 
      filter(Region %in% input$selRegion) %>%
      distinct(Branch) %>% pull() %>%
      as.character()
  })
  
  
  output$select_Branch <- renderUI({
    
    selectizeInput(label='Branch',
                   inputId='selBranch',
                   choices=  c("select" = "",levels(choice_Branch())),
                   multiple=FALSE
        
    )})
  
  
  output$select_Mode <- renderUI({
    #Choice_FinMode
    
    Choice_FinMode <- reactive({
      First_DF %>% 
        filter(Month %in%  input$monthSel) %>% 
        filter(Region %in% input$selRegion) %>%
        filter(Branch %in% input$selBranch) %>%
        pull(FinMode) %>% 
        as.character()
    })
    
    selectizeInput(label='Mode',
                   inputId='selMode',
                   choices=c("select" = "",Choice_FinMode()) 
                   
               
    )
    
  })

}

# Run the application 
shinyApp(ui = ui, server = server)

Hi, can you provide a reproducible example?

Have a look at the dynamic UI article below. It should help with what you are after.

Some useful reading:

https://heds.nz/posts/dependent-selectInputs-shiny/

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.