我正在尝试在侧栏中创建一个带有多个标签的仪表板,仪表板主体依赖于这些标签。 1选项卡中有1个选择输入。但是当我点击Tabs时,仪表板Body不会改变。我尝试过几次使用" updatetabitems"但都是徒劳的。非常感谢提前!
以下是示例参考代码
##UI
library(shinydashboard)
library(shiny)
sidebar= dashboardSidebar(
sidebarMenu(
menuItem("Dashboard", tabName = "tab1", icon = icon("dashboard"),
fluidRow(
selectInput("options",label=h5("Select Column"),""))),
menuItem("Widgets", tabName = "tab2", icon = icon("th"),
fluidRow(
selectInput("options",label=h5("Select Column"),"")))
)
)
body= dashboardBody(
tabItems(
# First tab content
tabItem(tabName = "tab1",
fluidRow(
box(plotOutput("plot1", height = 250))
)
),
# Second tab content
tabItem(tabName = "m2",selected=TRUE,
h2("Widgets tab content")
)
)
)
dashboardPage(
dashboardHeader(title= "city"),sidebar,body)
##Server
server <- function(input, output) {
outputplot1= renderPlot({
})
}