rshinyr-shinylive

How to stop Rshiny refresh data before I finish multiple input selection (before I hit enter)


I have 1 input in Rshiny that needs multiple inputs:

selectInput("selected_herd", "Select Herd", selected = herds_list[1], choices = herds_list, multiple = TRUE)

In the application, while I am adding multiple herds, the app refreshes the data before I hit enter. Is there anyway to stop this? and make the app refresh data only after I finish the input list and hit enter?

In the photo attached, you can see that I am about to start entering the list of herds, but the app already refreshes the data on an empty list and show errors.

What I want is the app to show result of the previous selection(photo 2) until I finish new selection and hit enter. Anyone knows how to do this? Thank you very much!!! enter image description here

enter image description here


Solution

  • So here is my solution:

    In ui, I add an action buttion under the select herd box:

    ,actionButton("run_estimates", "Run Report",icon = icon('cogs'), class='btn-success fa-lg')
    

    In server, I add 2 lines of codes at the beginning of my reactive function

    input$run_estimates
    ptpt <- isolate(input$selected_herd)