Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

272
Views
Cómo habilitar la alternancia entre 3 elementos de menú en la barra lateral brillante del tablero

Me gustaría hacer plegables los elementos del menú en mi tablero brillante.

Encontré la publicación con una pregunta similar que había sido respondida hace algún tiempo:

solución al problema con 2 div-s

Sin embargo, la solución solo funciona con 2 div-s . ¿Es posible hacer algo similar con 3 elementos del menú ?

Código reproducible adjunto (publicado por Martin Schmelzer)

 library(shiny) library(shinydashboard) server <- function(input, output) { } jsc <- ' $(document).ready(function () { $(".sidebar-menu").children("li").on("click", function() { $("#mult, #single").toggle(); }); }); ' ui <- dashboardPage( dashboardHeader(title = "Dashboard", titleWidth = 290), dashboardSidebar( width = 290, sidebarMenu( menuItem( "Multiple Incident Analysis", tabName = "dashboard", icon = icon("th")), div(id = "mult", splitLayout(cellWidths = c("44%", "31%", "25%"), dateInput("datefrom", "Date From:", format = "mm/dd/yyyy", Sys.Date()-5), textInput("datefrom_hour", "Hour", value = "12:00"), textInput("datefrom_noon","AM/PM", value = "AM")), splitLayout(cellWidths = c("44%", "31%", "25%"), dateInput("dateto", "Date To:", format = "mm/dd/yyyy"), textInput("dateto_hour", "Hour", value = "11:59"), textInput("dateto_noon","AM/PM", value = "PM"))), menuItem("Single Analysis", tabName = "widgets", icon = icon("th")), div(id = "single", style="display: none;", numericInput("tckt", "Ticket Number : ", 12345, width = 290)), submitButton("Submit", width = "290") )), dashboardBody( tags$head(tags$script(jsc)) )) shinyApp(ui, server)
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

En shinydashboard , menuItem ya hace eso para tantos elementos de menú como quieras. Prueba esto

 library(shiny) library(shinydashboard) server <- function(input, output) { } ui <- dashboardPage( dashboardHeader(title = "Dashboard", titleWidth = 290), dashboardSidebar( width = 290, sidebarMenu( menuItem( "Multiple Incident Analysis", tabName = "dashboard", icon = icon("th"), div(id = "mult", splitLayout(cellWidths = c("44%", "31%", "25%"), dateInput("datefrom", "Date From:", format = "mm/dd/yyyy", Sys.Date()-5), textInput("datefrom_hour", "Hour", value = "12:00"), textInput("datefrom_noon","AM/PM", value = "AM")))), menuItem( "Multiple Incident Analysis2", tabName = "dashboard2", icon = icon("th"), div(id = "mult2", splitLayout(cellWidths = c("44%", "31%", "25%"), dateInput("dateto", "Date To:", format = "mm/dd/yyyy"), textInput("dateto_hour", "Hour", value = "11:59"), textInput("dateto_noon","AM/PM", value = "PM")))), menuItem("Single Analysis", tabName = "widgets", icon = icon("th"), div(id = "single", numericInput("tckt", "Ticket Number : ", 12345, width = 290))), submitButton("Submit", width = "290") )), dashboardBody() ) shinyApp(ui, server)
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!