[英]Shinydashboard 'topbar'
Is it possible to place some items in the horizontal bar next to the dashboardHeader
? 是否可以将一些项目放在
dashboardHeader
旁边的水平栏中? I know you can place notificationItem
on the far right like in this example . 我知道你可以在最右边放置
notificationItem
,就像在这个例子中一样 。 But I would like to use the same options as in dashboardSidebar
like adding filters etc. I want such a filter on top: 但我想使用与
dashboardSidebar
相同的选项,如添加过滤器等。我想在顶部使用这样的过滤器:
Hi You can do something like this: 嗨您可以这样做:
library(shiny)
library(shinydashboard)
CustomHeader <- dashboardHeader()
CustomHeader$children[[3]]$children <- div(style="min-width:200px;",tags$input(id="searchbox",placeholder = " Search...",type="text",class="chooser-input-search",style="width:200px;height:50px;"))
ui <- dashboardPage(
CustomHeader,
dashboardSidebar(),
dashboardBody()
)
server <- function(input, output, session) {}
shinyApp(ui, server)
Based on Pork Chop answer, you can simply use selectInput
(or other shiny inputs) that you put in a div
with float:left
to span horizontally: 根据Pork Chop的答案,您可以简单地使用
selectInput
(或其他闪亮的输入)放入div
使用float:left
来横向跨越:
CustomHeader <- dashboardHeader()
CustomHeader$children[[3]]$children <- list(
div(style="float:left;height:50px",selectInput("select1", NULL, c("a","b","c"))),
div(style="float:left;height:50px",selectInput("select2", NULL, c("d","e","f"))))
ui <- dashboardPage(
CustomHeader,
dashboardSidebar(),
dashboardBody(textOutput("text1"),textOutput("text2"))
)
server <- function(input, output, session) {
output$text1 <- renderText({input$select1})
output$text2 <- renderText({input$select2})
}
shinyApp(ui, server)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.