Determine if DT datatable is clicked in shiny app

Viewed 6738

Here is a working example of my best attempt to get table click event:

library(shiny)
library(DT)

runApp(shinyApp(
  ui = fluidPage(DT::dataTableOutput('table')),
  server = function(input, output, session) {
    output$table <- DT::renderDataTable({
      dt <- data.frame(a = 1)
      datatable(dt, rownames = FALSE, selection = 'none')
    })
    observeEvent(input$table_cell_clicked, {
      print(Sys.time())
    })}
))

The problem is that observeEvent reacts only if user clicks on the cell which differs from previously clicked. Is there a way to get event on any table click?

1 Answers
Related