Shiny renderDataTable table_cell_clicked

DT initializes input$tableId_cell_clicked as an empty list, which causes observeEvent to trigger since observeEvent only ignores NULL values by default. You can stop the reactive expression when this list is empty by inserting something like req(length(input$tableId_cell_clicked) > 0).

Here's a slightly modified version of your example that demonstrates this.

library(shiny)

ui <- fluidPage(
  actionButton("getQueue", "Get list of queued files"),
  verbatimTextOutput("devel"),
  DT::dataTableOutput("fileList")     
)

shinyServer <- function(input, output) {

  tbl <- eventReactive(input$getQueue, {
    mtcars
  })

  output$fileList <- DT::renderDataTable({
    tbl()
  }, selection = 'single')

  output$devel <- renderPrint({
    req(length(input$fileList_cell_clicked) > 0)
    input$fileList_cell_clicked
  })
}

shinyApp(ui = ui, server = shinyServer)

Tags:

R

Dt

Shiny