submitButton for conditionalPanel (code included)

58 views
Skip to first unread message

John Williams

unread,
Aug 23, 2016, 12:06:01 PM8/23/16
to Shiny - Web Framework for R
Similar/related questions in this forum and stackoverflow but none answer my question.

Trying to Implement conditionalPanel with tabsetPanel in ui.R.
Having trouble implementing a "submitButton-like" action for each conditional panel:
 
## ui.R ##
shinyUI(fluidPage(
  titlePanel("...."),  
  sidebarLayout(
    sidebarPanel(
      
      conditionalPanel(
        condition = "input.tabs == 'tab_a'",
        selectInput(.....),
        selectInput(.....),
        radioButtons(....),
        sliderInput(....),
        #?? submitButton("button label A", icon("refresh"))
        # or ?? actionButton("button label A", "TAB A" )
      ),      
      conditionalPanel(
        condition = "input.tabs == 'tab_b'",
        selectInput(....),
        selectInput(....),
        sliderInput(...),
        # ?? submitButton("button label B;", icon("refresh"))
        # or ??  actionButton("button label B", "TAB B" )
      ) ),     
    mainPanel(
      tabsetPanel(id = "tabs",
        tabPanel("TAB A",  plotOutput(...), value = "tab_a"),
        tabPanel("TAB B",  plotOutput(...), value = "tab_b")    )))))

Ive tried every variation of submitButton & actionButton I can think of.

Any ideas how to implement a submitButton-like action for/in each conditional panel? 
Thanks in advance.

Joe Cheng

unread,
Aug 23, 2016, 8:00:27 PM8/23/16
to John Williams, Shiny - Web Framework for R
In terms of outputs, is there just a single plotOutput for each tab?

--
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/760060d5-645a-4be7-b9e0-a17947c06c4b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

John Williams

unread,
Aug 23, 2016, 8:05:58 PM8/23/16
to Joe Cheng, Shiny - Web Framework for R
yes, one plotOuput for each tab  (but ... I would like the option of multiple plotOutputs and a textOutput for each tab)
thanks

To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discuss+unsubscribe@googlegroups.com.

Joe Cheng

unread,
Aug 23, 2016, 8:09:28 PM8/23/16
to John Williams, Shiny - Web Framework for R
You basically need to tie either the output itself, or else a reactive expression, to the action button. You would probably do the latter if you plan on having more outputs per tab later. Use calcA <- eventReactive(input$buttonA, {...}), for example. Then your plotting logic would use calcA() to get at the computed value.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.

John Williams

unread,
Aug 24, 2016, 11:49:17 PM8/24/16
to Joe Cheng, Shiny - Web Framework for R
conditionalPanel() - actionButton() - eventReactive()  is working (thank you); only problem is plot in each tab displays blank screen until actionButton is initially clicked  (unlike in shinydashboard with submitButton).

found this post from 2013 asking similar question but think solution may be deprecated.

any ideas how to programatically simulate an actionButton click in each tab upon app launch?

thanks in advance



To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discuss+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages