Man*_*wal 5 user-interface tabs r dynamic shinydashboard
如果有人可以提供帮助,我正在努力解决这个问题.我必须根据用户的tabpanel选择显示/隐藏Dashboardsidebar上的一些元素.以下是UI代码的一部分,可让您了解我的应用程序的结构.我需要在tabpPanel 2上显示fourthoutput,Fifthout和download按钮.
ui <- dashboardPage(
  dashboardHeader(title = "My App"),
  dashboardSidebar(
    width = 350,
    fileInput(
      'file1',
      'Upload Items List',
      accept = c('text/csv',
                 'text/comma-separated-values,text/plain',
                 '.csv')
    ),
    fluidRow(column(
      width = 2,
      offset = 1,
      actionButton("goButton", "Submit")
    )),
    br(),
    br(),
    uiOutput("FirstOutput"),
    uiOutput("SecondOutput"),
    uiOutput("ThirdOutput"),
    uiOutput("FourthOutput"),
    uiOutput("FifthOutput"),
      fluidRow(column(
        width = 2,
        offset = 1,
        downloadButton('downloadData', 'Download')))
  ),
  dashboardBody(
    tags$style(
      type = "text/css",
      ".shiny-output-error { visibility: hidden; }",
      ".shiny-output-error:before { visibility: hidden; }"
    ),
    tabsetPanel(
      type = "tabs",
      tabPanel("1", fluidRow(box(
        plotlyOutput("pie1")
      ),
      box(
        plotlyOutput("barplot1")
      )),
      fluidRow(box(
        plotlyOutput(outputId = "barplot2")
      ))),
      tabPanel("2",
        div(style = 'overflow-x: scroll', dataTableOutput("contents"))
      )
    )
  )
)
谢谢,Manoj Agrawal
你必须设置id为tabsetPanel和值到每个tabPanel.然后你可以使用input.tabsetId在conditionalPanel隐藏/显示按钮:
...
conditionalPanel(
  condition = "input.tabs == 'show'",
  fluidRow(column(
    width = 2,
    offset = 1,
    downloadButton('downloadData', 'Download'))))
),
...
...
tabsetPanel( id="tabs",
...
tabPanel("1", value="show",
...
tabPanel("2", value="hide",
...