Используя R блестящий, можно ли связать элемент selectInput с кнопкой открытия файла?Я хотел бы адаптировать кнопку аргумента действия onclick для достижения этого.
Ниже приведен воспроизводимый пример:
Предположим, у нас есть "file_1.pdf" и "file_2"..pdf "в папке" www ", как мне открыть файл, соответствующий выбранному варианту ввода?
library(shinydashboard)
library(shiny)
ui <- dashboardPage(
dashboardHeader(title = "Open file app"),
dashboardSidebar(),
dashboardBody(
fluidRow(
selectInput(inputId = "file_choice",label = "Choose the file to open",choices = c("file_1","file_2")),
actionButton("bell","Open the selected file", class = "btn action-button",onclick = "window.open('file_1.pdf')")) #onclick argument must be adapted
)
)
server <- function(input, output) {}
shinyApp(ui, server)
Большое спасибо!