Updating slider visual when changing value with JS

Hi I came a very similar issue as was posted here: Updating shiny input (visually) using JavaScript - shiny - RStudio Community.

I'm using Shiny.setInputValue() to update a slider with a value from a parent site. That is working internally. But the visual representation of the slider gets no visual update. Is there an attribute I cann add to my Shiny.setInputValue() call that forces the update? Or a JavaScript command that updates the slider visually I can add afterwards?

A workaround might be defining a reactive value and change that instead and than using updateSliderInput() on the server code to update the slider. But this seems pritty cumbersome if we have multiple visual inputs (of different types). (I had a look on the table example.)

I wonder why a visual update is not the default case anyway.

Here is a link to the app I'm currently working on: Old Faithful Geyser Data (shinyapps.io)

After some hours of messing around with endless loops of back and foreward changing values I came up with a solution. The app can send the change of a value to its parent frame and values in the app can be changed from the parent window as well. The change is not only internally but the slider is adjusted as well.

I implemented it with a not shown input$change variable that gets set TRUE from JS in the window.addEventListener. This is recogniced by an observeEvent. There the slider gets updated. Then it sends a message to JS and input$change gets set FALSE again in the Shiny.addCustomMessageHandler function. This is necessary because the reaction time of the observer is lower than the execution in the JS code.

Have a look on my example of a parent frame embedding the app linked above: Parent Frame

This topic was automatically closed 54 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.