r - 如何禁用shinydashboard中的tabPanel?

标签 r tabpanel shinydashboard

有没有办法在单击 actionButton 之前禁用 tabPanel?我尝试使用shinyjs来做到这一点,但没有奏效。目前我的 ui.R 有以下代码。我想禁用“过滤器”tabPanel,直到单击 loadButton。
`

body <- dashboardBody(
    useShinyjs(),
    tabsetPanel(id = "tabs", type = 'pills',
        tabPanel("Load", dataTableOutput("loadTab")),
        tabPanel("Filter", id='filterTab',dataTableOutput("filteredResults"))
    ))
sidebar <- dashboardSidebar(
        sidebarMenu(
         selectInput(inputId = "datasetName",label = 'Dataset',  choice=c('Cancer','Normal')),
         actionButton("loadButton", label = "Load")
        ))

`
任何帮助表示赞赏。

最佳答案

我得到它与shinyjs 一起工作。
`

    jsCode <- "
shinyjs.disableTab = function() {
    var tabs = $('#tabs').find('li:not(.active) a');
    tabs.bind('click.tab', function(e) {
        e.preventDefault();
        return false;
    });
    tabs.addClass('disabled');
}
shinyjs.enableTab = function(param) {
    var tab = $('#tabs').find('li:not(.active):nth-child(' + param + ') a');
    tab.unbind('click.tab');
    tab.removeClass('disabled');
}


`
然后根据需要启用和禁用选项卡。

关于r - 如何禁用shinydashboard中的tabPanel?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37382091/

相关文章:

R:双枢轴使用 DPLYR?

r - data.table - 检查一列是否在另一(列表)列中

R Shiny : Dynamically creating tabs with output within navbarPage()

javascript - extjs 6.5.2 modern - beforeremove、beforeclose、close not firing

r - 根据Shiny R中选定的日期范围触发查询

r - 如何在 lmer 或 glmer 中预测和绘制非线性变化斜率?

r - 动画化 googleVis 图

animation - 如何在sencha touch 2中更改选项卡面板上设置随机动画?

r - 无法使 Shiny 模块与 valueBox 一起使用

r - 错误 : argument "x" is missing, 没有默认值