Conditional Panel based on Active tab

5,789 views
Skip to first unread message

Andrew Clark

unread,
Nov 23, 2012, 9:10:42 PM11/23/12
to shiny-...@googlegroups.com
I want to change the selectInputs based on the Active tab and
looking at the tabsetPanel.Rd code it looks as though this should be possible
but I cannot work out how to refer to it in the conditionalPanel condition=


Joe Cheng

unread,
Nov 23, 2012, 9:35:11 PM11/23/12
to shiny-...@googlegroups.com
Give the tabsetPanel an inputId (e.g. tabs1, and optionally give each tabPanel a value. Then in conditionalPanel the condition is "input.tabs1 == 'tabname'"

Sent from my phone
--
 
 

Andrew Clark

unread,
Nov 26, 2012, 1:54:40 PM11/26/12
to shiny-...@googlegroups.com
Thanks

Renger van Nieuwkoop

unread,
Mar 17, 2013, 10:01:03 AM3/17/13
to shiny-...@googlegroups.com
Hi
I tried it but I wasn't able to implement it properly. Any idea what I am doing wrongly:

Here is my sidepanel code

    sidebarPanel(
        radioButtons("parameters", "Choose parameter or variable:",choices=parameters),  
        conditionalPanel(
            condition = "input$id == 'tab1'",
           selectInput(inputId="start", label="Choose a start node",choices=start)
        ),
        numericInput("obs", "Number of observations to view in second block:", 10)
        ),
 
and here the tabsetPanel
        tabsetPanel(
             tabPanel("Specific Arc Results",
                 tableOutput("view"),
                 plotOutput("plot"),
                 inputId = "tab1"
                 ),
            tabPanel("Statistical Summary",verbatimTextOutput("summary"), inputId="tab2"),
           tabPanel("All arc results",tableOutput("view2"), inputId="tab3")
         )

Thanks 
Renger

Joe Cheng

unread,
Mar 17, 2013, 11:06:05 AM3/17/13
to shiny-...@googlegroups.com
The tabsetPanel needs an id, not the tabPanel.
--
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.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


--
Sent from my phone

Renger van Nieuwkoop

unread,
Mar 17, 2013, 1:11:08 PM3/17/13
to shiny-...@googlegroups.com
Thanks, but I am too stupid to get it working. Could you give an code example? THanks in advance
Renger
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discuss+unsubscribe@googlegroups.com.

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

Renger van Nieuwkoop

unread,
Mar 17, 2013, 1:43:30 PM3/17/13
to shiny-...@googlegroups.com
got it working. Thanks
Renger

Joe Cheng

unread,
Mar 17, 2013, 2:23:04 PM3/17/13
to shiny-...@googlegroups.com
Great!
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.

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

Mayank

unread,
Apr 22, 2013, 4:41:53 AM4/22/13
to shiny-...@googlegroups.com

Amy Howes

unread,
Jul 5, 2013, 11:25:57 AM7/5/13
to shiny-...@googlegroups.com
Renger van Nieuwkoop, could you supply your code here, please? I, too, cannot get it to work.
Thanks!

Amy Howes

unread,
Jul 5, 2013, 11:38:26 AM7/5/13
to shiny-...@googlegroups.com
i have
 
shinyUI(pageWithSidebar(
 
  headerPanel('Hey!'),

  sidebarPanel(

conditionalPanel(
condition = "input.tabs1=='Map'",
sliderInput("grid", "Grid Cell for All:",min=3,max=2634,value=3,step=1,animate=TRUE)),

sliderInput("i", "Range of desired grid:",min=1,max=14,value=3),

checkboxInput(inputId = "Pvalues",
label = strong("Graph by p-values"),value=FALSE)
),
 
  mainPanel(

tabsetPanel(inputId ="tabs1",

tabPanel("North America",
plotOutput("allPlot",height=480,width=800)),

tabPanel("Uncertainty",
htmlOutput("testPlot")),

tabPanel("Map",
div(class="span12",plotOutput('RangePlot', clickId="coords", hoverId="hover"),height=800,width=800),
div(class="span6", tableOutput("hoverinfo")),
div(class="span6", tableOutput("clickinfo")))

    )
  )

))

Joe Cheng

unread,
Jul 5, 2013, 8:55:07 PM7/5/13
to shiny-...@googlegroups.com
tabsetPanel(inputId ="tabs1"

sadly this needs to be

tabsetPanel(id ="tabs1"

Sorry about that!


--

puneeth rao

unread,
May 24, 2017, 2:47:37 PM5/24/17
to Shiny - Web Framework for R
Hello guys,

I facing a similar issue where the conditional panels appear one below the other for both the tabs. I want 1 side panel for 1 tab. 

conditionalPanel(
           condition = "input.tabs == 'test2'",
      
                        
           sliderInput('sampleSize', 'Sample Size', min=100, max=3500,
                       value=min(100, 3500), step=50, round=0),
           
           downloadButton('downloadData', 'Download Sample')),
    
        conditionalPanel(
           condition = "input.tabs == 'test2'",
      
         
           sliderInput("slider2", "Call Duration", min = 0, 
                        max = 4000, value = c(200, 3000)),
                  
           downloadButton('downloadData', 'Download Sample'))),
  # Create a new row for the table.
           mainPanel(
                tabsetPanel(
                           tabPanel("test1",dataTableOutput("puneeth")),
                           tabPanel("test2",dataTableOutput("puneeth")),
                           id="tabs"
                           )
                    )
            )
Reply all
Reply to author
Forward
0 new messages