r - 下拉菜单未在 Shiny 的 tabPanel 中扩展

标签 r shiny

当下拉框作为选项卡面板的一部分包含在 Shiny 的应用程序中时,它的行为方式与选项卡面板外部的行为方式不同。在选项卡面板之外,当它处于事件状态时,它会延伸到包含它的元素之外,但作为选项卡面板,它受到限制,使其非常难以使用。

我希望能够在侧边栏面板中使用选项卡面板,有人可以建议如何让它们发挥作用吗?

在选项卡面板中(有问题)

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) {}))

最佳答案

您需要添加一些CSS。 .tab-content 上的溢出需要可见”

.tab-content {
  overflow: visible;
}

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

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) {}))

关于r - 下拉菜单未在 Shiny 的 tabPanel 中扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23233841/

相关文章:

python - 如何从 Azure 机器学习工作室中的 R 或 Python 脚本读取本地文件?

根据 R 中的名称向量删除列

R Shiny DT::renderDataTable 被覆盖的 "Processing..."横幅卡住

html - 如何减少 Shiny 的交互式 rmarkdown 利润?

render* 函数不会显示在 Shiny 模块内的 modalDialog 中

R - 将具有 "\t"和 "\n"的字符串变量转换为数据帧

r - R 中矩阵两列相乘之和

R Shiny 键输入绑定(bind)

具有可变列的 read.table

r - 如何减少 selectinput 中标签和选项之间的空间?