How to select a specific tabPanel in Shiny

后端 未结 1 739
囚心锁ツ
囚心锁ツ 2021-01-14 06:34

I am trying to select a specic tabPanel dynamically in the simply Shiny app. The script of app is as follows:

ui.r

library(shiny         


        
相关标签:
1条回答
  • 2021-01-14 07:20

    Problem is that you don't have a tabsetPanel in your UI (which should be the parent of the two tabPanel). Right now you are using updateTabsetPanel, but the target is navbarPage.

    Working solution below. There were two problems: navbarPage needs an id, and also there was an extra space in server.R selected (between Binning and input`

    ui.R

    library(shiny)
    shinyUI(fluidPage(
    
        titlePanel("SCORE CARD DEVELOPMENT PLATFORM"),
        navbarPage("ScoreDevApp",
                   tabPanel("Settings",
                            fluidRow(column(2,
                                            actionButton("goButton_service", "Load   saved parameters",width=200)
                            )
                            )
                   ),
                   tabPanel("Download & Binning input data"),
                   id="ScoreDevApp"
        )
    )
    )
    

    server.R

    library(shiny)

    shinyServer(function(input, output, session) {
        #load saved parameters 
        observeEvent(input$goButton_service, {
            updateNavbarPage(session, "ScoreDevApp", selected = "Download & Binning input data")
        })  
    })  
    
    0 讨论(0)
提交回复
热议问题