[英]How to disable a tabPanel in shinydashboard?
有沒有一種方法可以禁用tabPanel,直到單擊actionButton為止? 我試圖使用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');
}
”`,然后根據需要啟用和禁用選項卡。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.