Interactively change the selectInput choices

后端 未结 3 1272
滥情空心
滥情空心 2020-12-07 21:12

Originally I create this shiny interface that takes in a parameter \"company id\" and \"date\", but here we have a problem: most people dont know the companies we work with

3条回答
  •  天涯浪人
    2020-12-07 21:38

    In Shiny version 0.8 (where I have tested it), in server.R add the following:

    shinyServer(function(input, output, session) {
    
      observe({
        # This will change the value of input$partnerName to searchResult()[,1]
        updateTextInput(session, "partnerName", 
                        label = "Select your choice", 
                        value = searchResult()[,1])
      })
    
    })
    

    Now the function within shinyServer has additional argument session.

    You can skip the label if you don't need to change it.

    You don't need to change anything in ui.R.

提交回复
热议问题