0
我想顯示Shinydashboard輸入字段作爲menuSubItem類型,但是我發現很難寫出解決方案。R Shinydashboard:如何使用selectInput()(過濾器)在其中摺疊menuItem()?
- 家庭普及率(上點擊下拉菜單)
- 商店的過濾器
- 按鈕
- 銷售(家庭普及率菜單崩潰點擊次數和銷售功能下降)
- 過濾器x
你有什麼解決方案嗎?
ui.R
library(shiny)
library(shinydashboard)
library(leaflet)
source("R/load_metadata.R", chdir=TRUE)
# Header of the dashboard
header <- dashboardHeader(
title = "x",
titleWidth = 350,
dropdownMenuOutput("task_menu")
)
# Sidebar of the dashboard
sidebar <- dashboardSidebar(
sidebarMenu(
id = "menu_tabs",
menuItem("Household Penetration", tabName = "menutab1", icon = icon("percent")),
selectInput("storeInput", label = "Store",
choices = STOREFILTER$STORE_NAME,
selected = STOREFILTER$STORE_NAME[1]),
actionButton("Button", "Filter Map"),
menuItem("Sales", tabName = "menutab2", icon = icon("euro"))
)
)
# Body of the dashboard
body <- dashboardBody(
tabItems(
tabItem(
tabName = "menutab1",
tags$style(type = "text/css", "#mymap {height: calc(100vh - 80px) !important;}"),
leafletOutput("mymap")),
tabItem(
tabName = "menutab2",
tags$style(type = "text/css", "#mymap {height: calc(100vh - 80px) !important;}"),
h2("Dashboard tab content")
)
)
)
# Shiny UI
ui <- dashboardPage(
header,
sidebar,
body,
tags$head(
tags$style(HTML(type='text/css', "#Button { width:40%; margin-left: 30%; margin-right: 30%; background-color: #3C8DBC; color: black; font-weight: bold; border: 0px}")))
)