我有下面闪亮的应用程序,带有 3 个不同的选项卡、一个侧边栏和一个右侧边栏。我希望每次移动到另一个选项卡时,右侧边栏的内容都可以更改和显示不同的小部件。在第三个名为“Tax Loss Harvesting”的部分中,我想添加一个controlbarMenu()
. 我怎样才能使它仅在我在第三个选项卡中时显示?
library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
shinyApp(
ui = tags$body(class="skin-blue sidebar-mini control-sidebar-open",dashboardPage(
options = list(sidebarExpandOnHover = TRUE),
header = dashboardHeader(title = "Investment Advisor Monitoring - Insider Trading",titleWidth = 450),
sidebar = dashboardSidebar(minified = F, collapsed = F,
h4("Investment Selected")
),
body = dashboardBody(
h3('Results'),
tabsetPanel(id = "tabs",
tabPanel("InsiderTraining"),
tabPanel("Switching"),
tabPanel("Tax Loss Harvesting")
)
),
controlbar = dashboardControlbar(width = 300,
#controlbarMenu(
# id = "menu",
#controlbarItem(
# "Tab 1",
#"Welcome to tab 1"
#),
#controlbarItem(
# "Tab 2",
#"Welcome to tab 2"
#)
#)
h4("Insider Trading Parameters"),
uiOutput("mytab21"), uiOutput("mytab22"),uiOutput("mytab23")
),
title = "DashboardPage"
)),
server = function(input, output) {
output$mytab21 <- renderUI({
tagList(
conditionalPanel(condition = 'input.tabs=="InsiderTraining"',
selectInput("InsiderTradingModel", "Insider Trading Model",
c("Dynamic" = "Dynamic",
"AI based" = "AIbased")),
#textInput("StockTicker", "Enter Stock Symbol", value = "NFLX"),
selectInput("ivar", "Choose a variable", choices = colnames(iris))
))
})
output$mytab22 <- renderUI({
tagList(
conditionalPanel(condition = 'input.tabs=="Switching"',
selectInput("InsiderTradingModel2", "Insider Trading Model 2",
c("Dynamic" = "Dynamic",
"BI based" = "BIbased")),
sliderInput('periodss','Periods',min=1,max=100,value=30),
selectInput("pvar", "Choose a variable", choices = colnames(pressure))
))
})
output$mytab23 <- renderUI({
tagList(
conditionalPanel(condition = 'input.tabs=="Switching"',
))
})
}
)