Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shiny conditional navlist

Tags:

r

shiny

Using R and Shiny, I am using the answer to this question as the basis of my code but will act as a good minimal reproducible example. But I would like my shiny app that uses a navlistPanel to change to the next tabPanel after the done button has been clicked, is this possible?

I think that using the id argument and referencing it using input$id as it mentions on the documentation might work...but do not know how this is done. Any help would be much appreciated.

like image 414
h.l.m Avatar asked May 23 '15 19:05

h.l.m


1 Answers

You need an observer expression connected to the action button. Here is the code to be inserted in the server part of your minimal example:

observe({
  if (input$data_upload_done %% 2 == 0 ) {
     updateTabsetPanel(session, "mynavlist", selected = "Data Upload")
  } else {
     updateTabsetPanel(session, "mynavlist", selected = "Data Check")
  }
})
like image 195
GPierre Avatar answered Sep 21 '22 17:09

GPierre