rstudio / shinydashboard

Shiny Dashboarding framework
https://rstudio.github.io/shinydashboard/
Other
885 stars 300 forks source link

sidebarSearchForm not showing in sidebar-mini mode #264

Open dylancis opened 6 years ago

dylancis commented 6 years ago

Using the mini-sidebar mode where only menu icons is seen while sidebar is collapsed: the sidebarSearchForm widget is missing. Expanded sidebar image: image Collapsed: sidebar image: image

As you can see the button and helptext are shown as expected, only sidebarSearchForm is missing. Reproducible example below:

## app.R ##
library(shiny)
library(shinydashboard)
library(shinyjs)

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(sidebarMenu(menuItem(text = "My History", icon = icon("question"),
                                        helpText("Can you see the sidebarSearchForm while sidebar is collapsed?"),
                                        shinydashboard::sidebarSearchForm(textId = "txtSearch", buttonId = "btnSearch",
                                                          label = "Search ..."),
                                        actionButton("btnTest", "Test"))
                               )),
  dashboardBody(useShinyjs())
)

server <- function(input, output) {
  runjs('
        var el2 = document.querySelector(".skin-blue");
        el2.className = "skin-blue sidebar-mini";
        ')
}

shinyApp(ui, server)
dylancis commented 6 years ago

Is there any workaround you know to have it appeared? Thank you.

dylancis commented 6 years ago

Thanks for your recommendation but using the code the issue remains exactly the same. Try to hover 'My Search' icon and you will see that the search field is missing in the floating sidebar. Image attached.

On Tue, 6 Mar 2018, 15:47 ismirsehregal, notifications@github.com wrote:

As you already mentioned, only menu icons are shown. So why don't you create another menuItem?

app.R

library(shiny) library(shinydashboard) library(shinyjs)

ui <- dashboardPage(dashboardHeader(), dashboardSidebar(sidebarMenu( menuItem( text = "My History", icon = icon("question"), helpText("My Text"), actionButton("btnTest", "Test") ), menuItem( text = "My Search Form", icon = shiny::icon("search"), shinydashboard::sidebarSearchForm( textId = "txtSearch", buttonId = "btnSearch", label = "Search..." ) ) )), dashboardBody(useShinyjs()))

server <- function(input, output) { runjs( ' var el2 = document.querySelector(".skin-blue"); el2.className = "skin-blue sidebar-mini"; ' ) }

shinyApp(ui, server)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rstudio/shinydashboard/issues/264#issuecomment-370825614, or mute the thread https://github.com/notifications/unsubscribe-auth/AEvvMYTvct4zC-BdWVWV0mauZhkM_F6qks5tbq98gaJpZM4SXCXS .