shinyWidgets icon indicating copy to clipboard operation
shinyWidgets copied to clipboard

pickerInput not working as expected when used w/ semantic.dashboard

Open AlexPars opened this issue 2 years ago • 1 comments

Let me start by saying that shinyWidgets is a great R package.

I also wanted to inquire about possible solution(s) for the following issues encountered when using pickerInput in combination with semantic.dashboard:

  • visual output in UI, created using pickerInput, is not a dropdown menu
  • when clicking on the visual output the entire list of options (passed as input to pickerInput ) shows up in UI, and cannot be closed

See snapshot of UI as Shiny app starts , First_shinyWidget and then a second snapshot when clicking on the box containing the value to select Second_shinyWidget

Here is the code used to create this dashboard

`if(interactive()){

ui <- semantic.dashboard::dashboardPage(

header = semantic.dashboard::dashboardHeader(
  color = "blue", 
  title = "Dashboard Test", 
  inverted = TRUE
),

sidebar = semantic.dashboard::dashboardSidebar(
  size = "thin", 
  color = "teal",
  semantic.dashboard::sidebarMenu(
    semantic.dashboard::menuItem(
      tabName = "tabID_main", 
      "Main Tab"),
    semantic.dashboard:: menuItem(
      tabName = "tabID_extra", 
      "Extra Tab")
  )
),

body = semantic.dashboard::dashboardBody(
  semantic.dashboard::tabItems(
    
    selected = 1,
    
    semantic.dashboard::tabItem(
      tabName = "tabID_main",
      semantic.dashboard::box(
        shiny::h1("Main body"), 
        title = "A b c", 
        width = 16, 
        color = "orange",
        
        shinyWidgets::pickerInput(
          inputId = "ID_One",
          choices = c("Value One","Value Two","Value Three"),
          label = shiny::h5("Value to select"),
          selected = "Value Two",
          width = "fit",
          inline = TRUE),
        
        shiny::verbatimTextOutput(outputId = "res_One")
      )
    ),
    
    semantic.dashboard::tabItem(
      tabName = "tabID_extra",
      shiny::h1("extra")
    )
    
  )
)

)

server <- function(input, output, session) { output$res_One <- shiny::renderPrint(input$ID_One) }

shiny::shinyApp(ui, server)

}

`

I am using

  • R version 3.6.3 64-bit on Windows computer
  • R packages as of checkpoint date 2021-05-15
  • shinyWidget version 0.6.0
  • semantic.dashboard version 0.2.0

AlexPars avatar Jun 07 '22 17:06 AlexPars

Hello,

That's because pickerInput() needs Bootstrap to work properly, and semantic.dashboard doesn't use Bootstrap like normal shiny applications.

An alternative can be to use virtualSelectInput widget which have similar functionalities (or even more) and comes with no framework dependencies (bootstrap, semantic, ...)

Victor

pvictor avatar Jul 13 '22 09:07 pvictor