I would like to open a context menu, when right clicking on a row of a datatable.
The context menu would then propose to the user the option of opening a file whose path is stored in the corresponding row of the datatable, here in the column Path
. How can I achieve that ? Below a simple example:
library(shiny)
library(DT)
ui <- fluidPage(
DTOutput("myTable")
)
server <- function(input, output, session) {
data <- data.frame(
Name = c("File1", "File2", "File3"),
Path = c("C:/Path/File1.txt", "C:/Path/File2.txt", "C:/Path/File3.txt")
)
output$myTable <- renderDT({
datatable(data, escape = FALSE)
})
}
shinyApp(ui, server)