title: R shiny renderTable change cell colors
body: <p>I have a table and want to color every cell depending on the value (0-100) in X(=6) different shades of blue. The table is shown in a TabPanel.</p>
  
  <p>Currently I am using shinyjs to call a javascript function which selects my table and add CSS styling to the <code>&lt;td&gt;</code> tags, depending on the value range.</p>
  
  <p>The Problem is, that on the first loading of the table (click on TabPanel), no color is shown, only after reloading again.</p>
  
  <p>So I am either looking for a solution in R (without the need for extra Javascript), or a method to automatically reload a Table/TabPanel.</p>
  
  <pre><code>library(shiny)
  
  ui &lt;- shinyUI(fluidPage(
      tableOutput("dataTable")
    ))
  
  server &lt;- shinyServer(function(input, output) {
  
    output$dataTable &lt;- renderTable({
      data &lt;- getDataFromSomeWhere();
      //Some operations on data
      data
      //I want to color every table cell, depening on value (f.e. 0-5 = white, 10-20 = light blue ...)
    }, rownames = TRUE, colnames = TRUE)
  
  shinyApp(ui = ui, server = server) 
  </code></pre>
  
  <p><strong>UPDATE</strong>
  In the end I stayed with the JavaScript solution, but used the shiny specific js events to get the desired effect:</p>
  
  <pre><code>$(document).on("shiny:value", function(e) {
    if (e.name == "myComponent") {
      e.preventDefault();
      $('#myComponent').html(e.value);
      //color code etc.
  }
  </code></pre>