title: R Shiny DataTable How to prevent row selection/deselection in columns containing hyperlinks
body: <p>I am dealing with a datatable with clickable element. A column of the row contains a hyperlink. When the hyperlin is clicked I don't want the row click event to be fired or managed (to select / deselect).</p>
  
  <p>What I have tried on R Shiny: </p>
  
  <pre><code>function preventDefault(e) {
     e.preventDefault();
     e.stopPropagation();
  
     return false;
  }
  </code></pre>
  
  <p>The element in DataTable which contains link:</p>
  
  <pre><code>&lt;a href="#" onclick="preventDefault(event)";&gt;
  </code></pre>
  
  <p>But nothing happened. </p>
  
  <p>The full source code: </p>
  
  <pre><code>library(shiny)
  library(DT)
  library(dplyr)
  
  ui &lt;- fluidPage(
  
     # Application title
    DT::dataTableOutput("DTExample")
  
  
  )
  
  server &lt;- function(input, output) {
    dat &lt;- head(iris)
  
    dat &lt;- dat %&gt;% mutate(clickme = '&lt;a href="#" 
                       onclick="event.preventDefault(); event.stopPropagation(); alert(event); return false;";
                       &gt;CLICKME&lt;/a&gt;')
  
    output$DTExample&lt;- renderDataTable({
      datatable(dat, escape = FALSE, class = 'cell-border stripe')
    }) 
  }
  
  # Run the application 
  shinyApp(ui = ui, server = server)
  </code></pre>