title: How to use downloadHandler for the download button create inside shiny datatable?
body: <p>I created download button inside each row of shiny datatable as shown <a href="https://stackoverflow.com/questions/45739303/r-shiny-handle-action-buttons-in-data-table">here</a>. The table is inside one of the shiny module. I wonder which id should be attached to output while using <code>downloadHandler</code> for any of the download button ? I have shown questionable value as <code>XXXXXXXXXXXX</code> in the code below. </p>
  
  <pre class="lang-r prettyprint-override"><code>library(shiny)
  library(DT)
  #&gt; 
  #&gt; Attaching package: 'DT'
  #&gt; The following objects are masked from 'package:shiny':
  #&gt; 
  #&gt;     dataTableOutput, renderDataTable
  
  
  ## module UI
  test_data_table_ui  &lt;- function(id){
    ns &lt;- NS(id)
    tagList(
      DT::dataTableOutput(outputId = ns("my_data_table"))
    )
  
  }
  
  ## module server
  test_data_table_server &lt;- function(input, output, session ){
    ns = session$ns
  
    myValue &lt;- reactiveValues(check = '')
  
    shinyInput &lt;- function(FUN, len, id, ns, ...) {
      inputs &lt;- character(len)
      for (i in seq_len(len)) {
        inputs[i] &lt;- as.character(FUN(paste0(ns(id), i), ...))
      }
      inputs
    }
  
  
    my_data_table &lt;- reactive({
      tibble::tibble(
        Name = c('Dilbert', 'Alice', 'Wally', 'Ashok', 'Dogbert'),
        Motivation = c(62, 73, 3, 99, 52),
        Actions = shinyInput(downloadButton, 
                             5,
                             'button_',
                             ns = ns,
                             label = "Download",
                             onclick = sprintf("Shiny.setInputValue('%s', this.id)",ns("select_button"))
        )
      )
    })
  
  
  
    # output$XXXXXXXXXXXX &lt;- downloadHandler(
    #   filename = function() {
    #     paste('data-', Sys.Date(), '.txt', sep='')
    #   },
    #   content = function(file) {
    #     readr::write_delim(x = mpg, path = file, delim = "\t")
    #   }
    # )
  
  
    observeEvent(input$select_button, {
      print(input$select_button)
    })
  
  
    output$my_data_table &lt;- DT::renderDataTable({
      return(my_data_table())
    }, escape = FALSE)
  
  
  
  }
  
  
  ui &lt;- fluidPage(
    test_data_table_ui(id = "test_dt_inside_module")
  )
  
  server &lt;- function(input, output, session) {
    callModule(module = test_data_table_server , id = "test_dt_inside_module")
  }
  
  shinyApp(ui, server)
  #&gt; 
  #&gt; Listening on http://127.0.0.1:3059
  </code></pre>
  
  <p><img src="https://i.imgur.com/mR5bnd8.png" alt=""></p>
  
  <p><sup>Created on 2019-09-17 by the <a href="https://reprex.tidyverse.org" rel="nofollow noreferrer">reprex package</a> (v0.3.0)</sup></p>