title: Checkboxes in DT shiny
body: <p>I'm trying to make checkboxs into DT table and collect information about checked rows.<br>
  My code below </p>
  
  <pre><code>shinyApp(
    ui = fluidPage(
      fluidRow(
        verbatimTextOutput("value1"),
        column(12,
               DT::dataTableOutput('table'),  tags$script(HTML('$(document).on("click", "input", function () {
                         var checkboxes = document.getElementsByName("selected");
                         var checkboxesChecked = [];
                         for (var i=0; i&lt;checkboxes.length; i++) {
                         if (checkboxes[i].checked) {
                         checkboxesChecked.push(checkboxes[i].value);
                        }
                        }
                       Shiny.onInputChange("checked_rows",checkboxesChecked);  })'))
        ))),
    server = function(input, output) {
      library(DT)
      library(glue)
      output$value1 &lt;- renderPrint({ input$checked_rows }) 
  
      output$table &lt;- DT::renderDataTable({
        iris$checked&lt;-''
        iris$checked[2:5]&lt;-'checked=\"checked\"'
        iris[["Select"]]&lt;-glue::glue('&lt;input type="checkbox" name="selected" {iris$checked} value="{1:nrow(iris)}"&gt;&lt;br&gt;')
        datatable(iris,escape=F,rownames=F,  class = 'cell-border compact', 
                  options=list(ordering=T,autowidth=F,scrollX = TRUE,
                  columnDefs = list(list(className = 'dt-center', targets = "_all"))
                  ),
                  selection="none"
        ) })})
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/FTvXd.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/FTvXd.gif" alt="enter image description here"></a></p>
  
  <p>All looking good, but:<br>
  1. when I make a choice in checkboxes and change the page, all data from the previous page disappears.<br>
  2. Also, as you can see on verbatimTextOutput ("value1"), it's worth selecting only checkboxes from the current page. How can I poll the entire table, and not just the page that I see?</p>
  
  <p>Thanks!</p>