Reputation: 5121
input_holder <- reactiveValues(
a = 7
)
observeEvent(input$a_button, {
# does some computation that arrives at some_number
input_holder$a <- some_number
})
observeEvent(input$slider_name, {
# should do something only if not caused by input$a_button
})
output$some_output <- renderUI({
sliderInput('slider_name', 'some_label', max=10, min=1, value=input_holder$a)
})
So the above is the model of my code.
So here is how I think the order of events will happen if a_button is pressed.
The observeEvent that observes a_button will get triggered and sets input_holder$a to some_number.
This will cause the slider_name to get rendered with this new value.
But that is not the behavior that I want. I only want the observeEvent that listens to slider_name to execute its block of code if the slider_name was altered by the user and not as a side effect by some other Event.
Upvotes: 0
Views: 204
Reputation: 2959
I think you're looking for updateSliderInput
, which will update the slider without re-rendering:
observeEvent(input$a_button, {
# does some computation that arrives at some_number
# input_holder$a <- some_number # do you need to store the value? If you do, I think you should use eventReactive
updateSliderInput(session, "slider_name", value = some_number)
})
Upvotes: 2