下拉列表不会在闪亮的tabPanel中延伸

时间:2014-04-23 02:41:54

标签: r shiny

如果下拉框作为闪亮应用中标签面板的一部分包含在内,则其行为方式与标签面板外部的行为方式不同。在选项卡面板之外,当它处于活动状态时,它会延伸到包含它的元素之外,但作为选项卡面板,它会受到限制,因此很难使用。

我希望能够在sidebarPanel中使用标签面板,任何人都可以建议如何让它们表现出来吗?

在标签面板中(有问题)

library(shiny)

runApp(list(
  ui = pageWithSidebar(
    headerPanel("Dropdown issues in panels"),
    sidebarPanel(
      tabsetPanel(id="tabsetLeft",
                  tabPanel("Panel1",
                           selectInput("select1", "Select", 1:5)
                  ))),
    mainPanel()),
  server = function(input, output) {}))

在标签面板之外(我希望它如何运作)

library(shiny)

runApp(list(
  ui = pageWithSidebar(
    headerPanel("Dropdown issues in panels"),
    sidebarPanel(
      selectInput("select1", "Select", 1:5)),
    mainPanel()),
  server = function(input, output) {}))

1 个答案:

答案 0 :(得分:2)

你需要添加一些CSS。 .tab-content上的溢出需要显示"

.tab-content {
  overflow: visible;
}

您可以将styles.css添加到应用目录或内联的www文件夹中:

library(shiny)

runApp(list(
    ui = pageWithSidebar(
        headerPanel("Dropdown issues in panels"),
        sidebarPanel(
            tabsetPanel(id="tabsetLeft",
                        tabPanel("Panel1",
                                 selectInput("select1", "Select", 1:5)
                        ))),
        mainPanel(tags$head(tags$style(type="text/css", ".tab-content {overflow: visible;}")))),
    server = function(input, output) {}))