how to refresh automatically a shiny page

2,449 views
Skip to first unread message

Chiara

unread,
Feb 24, 2015, 10:58:20 AM2/24/15
to shiny-...@googlegroups.com
Hi everybody,
I hope somebody can help me. I have a shiny app which shows a table calculated with reactive functions from a sql server database. I'm done the table, and I put it in sidebarPanel.
Now, since the data in the sql server database vary continuously i'd like to automatically refresh the table every 5 minutes. Is it possible?
I tried also to put in a button for refresh the table, but it doesn't work, maybe because no input vary?

In summary, i'd like that the table in my page would be automatically recalculated every 5 minutes and also when the button is pressed.
Is there a way to do this? Every suggestion will be appreciated!
Thanks a lot,
Chiara



Jonah

unread,
Feb 24, 2015, 1:44:54 PM2/24/15
to shiny-...@googlegroups.com
Check out the invalidateLater and reactiveTimer functions. I haven't used them, but I think they could help you make this work. 

Joe Cheng

unread,
Feb 24, 2015, 2:23:08 PM2/24/15
to Jonah, shiny-...@googlegroups.com
Put in an actionButton("refresh", "Refresh") in your UI, then as the first lines of your renderTable (or renderDataTable?) expression, put:

    input$refresh
    invalidateLater(1000 * 60 * 5, session)

--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/d193bfb0-098b-4d4b-a6cc-56ae9411bf10%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Chiara

unread,
Feb 25, 2015, 5:08:56 AM2/25/15
to shiny-...@googlegroups.com
Thank you very much guys, I appreciated a lot your help and I solved my issue.

Pierrick KINIF

unread,
Aug 12, 2019, 1:16:25 AM8/12/19
to Shiny - Web Framework for R
Hi Chiara,

How did you solve your issue? I have the same.

Kind regards,
Reply all
Reply to author
Forward
0 new messages