-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Description
Hi,
I tried to use the ShinyFiles component (shinyFilesButton) in the Quarto dashboard, but when I clicked on the button, the dialog window did not open. I tested it, both using 'Run Document' from RStudio and Quarto CLi with quarto serve but I got the same problem.
The same code on the Shiny app works well.
Any help is appreciated, Can be fixed with some workaround or do you need to change your code?
Here is my code for the qmd file :
`---
title: "CSV File Reader Dashboard"
author: " "
format: dashboard
server: shiny
# Load required libraries
library(shiny)
library(shinyFiles)
library(DT)
library(fs)
{.sidebar}
# Display the selected file path
shinyFilesButton("file", "Choose CSV File", "Please select a file", multiple = FALSE)
# Display the selected file path
textOutput("file_path")
# Display the contents of the CSV file
DTOutput("file_contents")
#| context: server
# Define the volumes available for file selection
volumes <- c(Home = fs::path_home(), getVolumes()())
# Handle file selection
shinyFileChoose(input, "file", roots = volumes, session = session)
# Reactive to handle file uploads
file_path <- reactive({
req(input$file)
parseFilePaths(volumes, input$file)$datapath[1]
})
# Display the selected file path
output$file_path <- renderText({
req(file_path())
paste("Selected file:", file_path())
})
# Read and display the contents of the selected file
output$file_contents <- renderDT({
req(file_path())
file_contents <- read.csv(file_path())
datatable(file_contents)
})
`
I run it on Windows with
R - 4.4.2
quarto - 1.6.39
Thanks
astamm
Metadata
Metadata
Assignees
Labels
No labels