For flexdashboard specifically, how to update selected tab on client

528 views
Skip to first unread message

Anh V.

unread,
Feb 22, 2017, 4:38:20 AM2/22/17
to Shiny - Web Framework for R
With Shiny, there is updateTabsetPanel, and for shinydashboard, there is updateTabItems. What do I do for flexdashboard?

Thanks immensely,
ANV

Bárbara Borges

unread,
Feb 23, 2017, 8:29:44 AM2/23/17
to Shiny - Web Framework for R
I don't think this is possible since you create tabsets in flexdashboard with markdown, instead or R code...

Anh V.

unread,
Feb 23, 2017, 2:24:27 PM2/23/17
to Shiny - Web Framework for R
Hmm, that makes things a little harder. Appreciate your input. I suppose I'll just have to learn how to do this with custom javascript, then. Hopefully someone can point me in the right direction.

Bárbara Borges

unread,
Feb 23, 2017, 2:46:38 PM2/23/17
to Shiny - Web Framework for R
Does your project have to be in flexdashboard? flexdahsboard is a much more limited tool than shinydashboard/shiny, and it only really shines when you want to make something simple, that won't require updates or complex interactions...

Anh V.

unread,
Feb 23, 2017, 9:38:52 PM2/23/17
to Shiny - Web Framework for R
I'll probably explore shinydashboard at some point, but for this project I've already written most of it for flexdashboard. Since I only needed to change the active tab if the app was being reloaded after an oauth2 redirect, I just checked the url string for that condition and have the document include something like below.

<script>window.location.hash = '#section-page-3';</script>

For interactive use, I think you can have the js function handled with session$sendCustomMessage to change the tab section.

Reply all
Reply to author
Forward
0 new messages