这是我的ui.R和server.R。我不确定为什么dashboardBody中的标题不显示。
server.R
shinyServer(function(input, output){
})
ui.R
dashboardPage(
dashboardHeader(title = "Analysis"),
dashboardSidebar(
sidebarMenu(
menuItem("Data Pull", tabName = "dataPull", icon = icon("database"),
dateInput("startDateInput", "What is the starting date?", value = NULL, min = NULL, max = NULL, format = "yyyy-mm-dd", startview = "month", weekstart = 0, language = "en"),
dateInput("endDateInput", "What is the ending date?", value = NULL, min = NULL, max = NULL, format = "yyyy-mm-dd", startview = "month", weekstart = 0, language = "en")
),
menuItem("View Data", tabName = "dataView", icon = icon("table"),
selectInput("dataViewSelectionInput", label = "Selection of Interest?", choices = c(1,2,3), multiple = TRUE),
checkboxInput("dataViewAll", label = "View all pulled", value = TRUE)
)
)
),
dashboardBody(
tabItems(
tabItem(tabName = "dataPull",
h1("Data Selected")
),
tabItem(tabName = "dataView",
h2("Viewing Data")
)
)
)
)
答案 0 :(得分:1)
目前,仪表板似乎不允许切换到选项卡并使用下拉菜单,我在此处找到了修复程序:
将此函数添加到UI的开头或您的全局:
λ> let f :: Int -> Int -> [Int]; f a x = [a .. x]
λ> f 1 2 ++ f 1 3
[1,2,1,2,3]
λ> [2, 3] >>= f 1
[1,2,1,2,3]
λ> f 1 =<< [2, 3]
[1,2,1,2,3]
然后您的ui文件变为:
ui.R
convertMenuItem <- function(mi,tabName) {
mi$children[[1]]$attribs['data-toggle']="tab"
mi$children[[1]]$attribs['data-value'] = tabName
mi
}
这是有效的,因为在menuitem中有一些默认行为,如果menuItem有子项,它将不会设置数据切换或数据值标记,所以我手动设置它们。 (编辑删除拼写错误)