簡體   English   中英

刪除特定tabPanel的sidebarPanel

[英]Removing a sidebarPanel for a specific tabPanel

我正在使用閃亮來做un R web應用程序,該應用程序由主面板左側的側邊欄面板(帶有2個tabpanel)和下面的另一個側邊欄面板組成。 我想保留第一個主面板的底部側邊欄,但是第二個主面板將其移除。 代碼如下:

  sidebarPanel(

    wellPanel(

      fileInput('file1', 'Choisissez les data service ?',
                accept = c('text/csv', 'text/comma-separated-values',
                'text/tab-separated-values', 'text/plain',
                '.csv', '.tsv', 'RData'
                )
      )


    ),


    wellPanel(

      selectInput(inputId = "fonction.de",
                  label = "En fonction de ?",
                  choices = fonctions.de,
                  selected = "perimetre_commercial_estime"
      ),


      selectInput(inputId = "perimetre",
                  label = "Perimetres commercial",
                  choices = perimetres,
                  selected = "2-HDM MARCHAND",
                  multiple = TRUE
      ),

      checkboxInput(inputId = "case1", label = "Tous perimetres", value = FALSE),


      selectInput(inputId = "ae",
                  label = "AE",
                  choices = aes,
                  selected = "AE Paris",
                  multiple = TRUE
      ),

      checkboxInput(inputId = "case2", label = "Tous AE", value = FALSE),


      selectInput(inputId = "segment",
                  label = "Segment commercial",
                  choices = segments,
                  selected = "Premium",
                  multiple = TRUE
      ),

      checkboxInput(inputId = "case3", label = "Tous segments", value = FALSE)





    )
  ),

  mainPanel(

    tabsetPanel(type = "tabs",
                tabPanel("Graphiques",
                         plotlyOutput("my.chart")),
                tabPanel("Tables", 
                         dataTableOutput("my.table"),
                         htmlOutput("my.text1"))

    )
  ),

  sidebarPanel(

    selectInput(inputId = "abscisse",
                label = "Abscisse",
                choices = abscisses,
                selected = "",
                multiple = FALSE
    ),


    selectInput(inputId = "ordonnee",
                label = "Ordonnee",
                choices = ordonnees,
                selected = "",
                multiple = FALSE
    )

  ),


  sidebarPanel(
    img(src="Dymetryyy.jpg", height = 150, width = 350)
  )


 )
)

對於面臨同樣問題的人,您必須使用conditionalPanel來解決它。

  mainPanel(

    tabsetPanel(id = "bab",
                type = "tabs",
                tabPanel(value = "graphiques",
                         "Graphiques",
                         plotlyOutput("my.chart")),
                tabPanel(value = "tables",
                         "Tables", 
                         dataTableOutput("my.table"),
                         htmlOutput("my.text1"))

    )
  ),

  conditionalPanel(condition = "input.bab == 'graphiques'",
    sidebarPanel(

      selectInput(inputId = "abscisse",
                  label = "Abscisse",
                  choices = abscisses,
                  selected = "",
                  multiple = FALSE
      ),


      selectInput(inputId = "ordonnee",
                  label = "Ordonnee",
                  choices = ordonnees,
                  selected = "",
                  multiple = FALSE
      )

    ),


    sidebarPanel(
      img(src="dymetryyy", height = 150, width = 350)
    )

  )

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM