title: How to align and draw borders on complex header for datatable in R shiny?
body: <p>I am using the container to create the header using the example from <a href="https://stackoverflow.com/questions/22897852/how-to-create-datatable-with-complex-header-in-r-shiny">here</a>. I am looking to center align the 'Overall' and 'In-patient' header. I tried adding the align = 'left' parameter in th function. It considers only two columns while center justifying. I am also trying to add the lines between the three header columns.</p>
  <p>This is the code snippet</p>
  <pre><code>  # a custom table container
       sketch = htmltools::withTags(table(
        class = 'display',
        thead(
          tr(
            th(rowspan = 2, style = &quot;text-align:center; border-right: solid 2px;&quot;, 'Condition'),
            th(align = 'center',
              th(colspan = 5, style = &quot;text-align:center;&quot;,'Overall'),
              th(colspan = 5, style = &quot;text-align:center;&quot;,'In-patient'),
              th(colspan = 5, style = &quot;text-align:center;&quot;,'Out-patient')
            )
          ),
          tr(
            lapply(rep(c('US.pat.count','freq','cond.rate','exp.rate','odds.ratio'), 3), th)
          )
        )
      ))
  
  datatable(df,rownames = FALSE,
        container = sketch,
        extensions = &quot;Buttons&quot;,
  
        options = list(
          dom = &quot;Blfrtip&quot;,
          scrollX = TRUE,
          buttons = c(&quot;excel&quot;),
          pageLength = 10,
          lengthMenu = c(10,20,50)
        )
  ) %&gt;% formatStyle(c(1,6,11,16), `border-right` = &quot;solid 2px&quot;)
      
  </code></pre>
  <p><a href="https://i.stack.imgur.com/pOSi6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pOSi6.png" alt="I want to add the lines between the columns too" /></a></p>
  <p>Here is the sample data I used</p>
  <pre><code>structure(list(concept_name = structure(c(8L, 4L, 9L, 10L, 6L, 
  3L, 2L, 7L, 1L, 5L), .Label = c(&quot;Abnormal findings on diagnostic imaging of lung&quot;, 
  &quot;Anemia&quot;, &quot;Disorder of bone&quot;, &quot;Essential hypertension&quot;, &quot;Fatigue&quot;, 
  &quot;Hyperlipidemia&quot;, &quot;Low back pain&quot;, &quot;Primary malignant neoplasm of prostate&quot;, 
  &quot;Raised prostate specific antigen&quot;, &quot;Secondary malignant neoplasm of bone&quot;
  ), class = &quot;factor&quot;), w_pop = c(220103, 172228, 120983, 132156, 
  134501, 63495, 76318, 64025, 65184, 63564), freq = c(&quot;97.36%&quot;, 
  &quot;76.18%&quot;, &quot;53.52%&quot;, &quot;58.46%&quot;, &quot;59.50%&quot;, &quot;28.09%&quot;, &quot;33.76%&quot;, &quot;28.32%&quot;, 
  &quot;28.83%&quot;, &quot;28.12%&quot;), w_cond_rate = c(1, 0.81, 0.58, 0.62, 0.72, 
  0.45, 0.48, 0.37, 0.39, 0.54), w_exp_rate = c(0.11, 0.74, 0.13, 
  0.01, 0.7, 0.12, 0.21, 0.26, 0.15, 0.29), w_odds_ratio = c(2006.65, 
  1.52, 8.99, 144.41, 1.15, 6.19, 3.55, 1.64, 3.6, 2.91), w_pop_in = c(77528, 
  75272, 3560, 44813, 51407, 5062, 27250, 7084, 21970, 5312), freq_in = c(&quot;62.15%&quot;, 
  &quot;60.34%&quot;, &quot;2.85%&quot;, &quot;35.92%&quot;, &quot;41.21%&quot;, &quot;4.06%&quot;, &quot;21.84%&quot;, &quot;5.68%&quot;, 
  &quot;17.61%&quot;, &quot;4.26%&quot;), w_cond_rate_inp = c(0.6288, 0.6224, 0.0287, 
  0.3755, 0.4539, 0.0782, 0.3305, 0.0701, 0.2193, 0.2548), w_exp_rate_inp = c(0.022457, 
  0.33757, 0.000987, 0.007383, 0.259038, 0.015242, 0.104238, 0.018032, 
  0.102137, 0.088998), w_odds_ratio_inp = c(73.75, 3.24, 29.96, 
  80.87, 2.38, 5.49, 4.24, 4.11, 2.47, 3.5), w_pop_out = c(219908, 
  169664, 115765, 130459, 128855, 57169, 71833, 59935, 56476, 54998
  ), freq_out = c(&quot;97.28%&quot;, &quot;75.05%&quot;, &quot;51.21%&quot;, &quot;57.71%&quot;, &quot;57.00%&quot;, 
  &quot;25.29%&quot;, &quot;31.77%&quot;, &quot;26.51%&quot;, &quot;24.98%&quot;, &quot;24.33%&quot;), w_cond_rate_outp = c(0.9952, 
  0.7906, 0.5568, 0.6119, 0.7001, 0.412, 0.4461, 0.3463, 0.3274, 
  0.4791), w_exp_rate_outp = c(0.113117, 0.730356, 0.130933, 0.010632, 
  0.684835, 0.104181, 0.192314, 0.255055, 0.115249, 0.261738), 
      w_odds_ratio_outp = c(1651.78, 1.39, 8.34, 146.8, 1.07, 6.03, 
      3.38, 1.55, 3.74, 2.6)), class = c(&quot;data.table&quot;, &quot;data.frame&quot;
  ), row.names = c(NA, -10L), .internal.selfref = &lt;pointer: 0x55e2614c3650&gt;)
  </code></pre>