juba / shinyglide

Glide.js component for Shiny apps
https://juba.github.io/shinyglide/
91 stars 8 forks source link

"Refresh" or clear output of current screen when you navigate away #20

Closed latlio closed 3 years ago

latlio commented 3 years ago

Hi, recently found your package, and thanks for developing it!

I was wondering if it's possible to "reset" inputs/outputs when you navigate away a screen.

For instance, if you have (using pseudocode here):

How do you reset selectInput and print(input) on Screens 1 and 3 respectively when you navigate to away from those screens?

juba commented 3 years ago

Hi,

I think this is outside the scope of shinyglide right now, you would have to implement it in JavaScript. The simpler way I can think of would be to registrer an handler for one of the Glide.js events :

https://glidejs.com/docs/events/

And then, in the handler, use Shiny.setInputValue() to reset your inputs :

https://shiny.rstudio.com/articles/communicating-with-js.html

juba commented 3 years ago

For information there is now a way to get pack the current slide as a Shiny input. See #22.