bs4Dash icon indicating copy to clipboard operation
bs4Dash copied to clipboard

shinyFiles not rendering with bs4Dash

Open rpodcast opened this issue 7 years ago • 2 comments

I like to use the excellent shinyFiles package in my shiny applications to let the user browse for files stored on server, and I noticed that I cannot get the typical shinyFiles dialog window to appear within a bs4Dash app. A simple reprex is below. Basically when you click the button to bring up the dialog, nothing happens. I don't see any messages appear in the R console after the button press, so I was not able to track down any helpful debugging information.

Here's the real :thinking: : If I use your awesome shinydashboardPlus package, then shinyFiles works without issue. A reprex for that case is below as well. I'm happy to assist with any additional debugging if you want more information.

shinyFiles with bs4Dash

library(shiny)
library(bs4Dash)
# devtools::install_github("thomasp85/shinyFiles")
library(shinyFiles)

shiny::shinyApp(
  ui = bs4DashPage(
    navbar = bs4DashNavbar(),
    sidebar = bs4DashSidebar(),
    controlbar = bs4DashControlbar(),
    footer = bs4DashFooter(),
    title = "Basic Dashboard",
    body = bs4DashBody(
      h1("shinyFiles Demo"),
      shinyFilesButton("file", "File select", "Please select a file", FALSE)
    )
  ),
  
  
  server = function(input, output, session) {
    
    volumes <- c("R Installation" = R.home())
    shinyFileChoose(input, "file",
                    roots = volumes, session = session, restrictions = system.file(package = "base"),
                    defaultRoot = "R Installation", defaultPath = "library"
    )
  }
)

shinyFiles with shinydashboardPlus

library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
# devtools::install_github("thomasp85/shinyFiles")
library(shinyFiles)

shiny::shinyApp(
  ui = dashboardPagePlus(
    dashboardHeaderPlus(),
    dashboardSidebar(),
    dashboardBody(
      h1("shinyFiles Demo"),
      shinyFilesButton("file", "File select", "Please select a file", FALSE)
    )
  ),
  
  
  server = function(input, output, session) {
    
    volumes <- c("R Installation" = R.home())
    shinyFileChoose(input, "file",
                    roots = volumes, session = session, restrictions = system.file(package = "base"),
                    defaultRoot = "R Installation", defaultPath = "library"
    )
  }
)

rpodcast avatar Jul 26 '18 22:07 rpodcast

shinyFiles uses bootstrap 3 so you cannot expect it to work out of the box with bootstrap 4

thomasp85 avatar Jul 27 '18 06:07 thomasp85

@rpodcast:

with the last devel version of bs4Dash, you should see some improvements. The dropdown menu is still not displayed.

library(shiny)
library(bs4Dash)
library(shinyFiles)

shiny::shinyApp(
  ui = bs4DashPage(
    navbar = bs4DashNavbar(),
    sidebar = bs4DashSidebar(),
    controlbar = bs4DashControlbar(),
    footer = bs4DashFooter(),
    title = "Basic Dashboard",
    body = bs4DashBody(
      h1("shinyFiles Demo"),
      shinyFilesButton("file", "File select", "Please select a file", FALSE),
      actionButton("show", "Show modal dialog")
    )
  ),
  
  
  server = function(input, output, session) {
    
    volumes <- c("R Installation" = R.home())
    shinyFileChoose(input, "file",
                    roots = volumes, session = session, restrictions = system.file(package = "base"),
                    defaultRoot = "R Installation", defaultPath = "library"
    )
    
    observeEvent(input$show, {
      showModal(modalDialog(
        title = "Important message",
        "This is an important message!"
      ))
    })
    
  }
)
Capture d’écran 2019-07-03 à 00 27 48

DivadNojnarg avatar Jul 02 '19 22:07 DivadNojnarg