Using format style and colorbar in datatable

I am trying to use the formatstyle option in DT to hightlight the column overall in my df. Along with that I am also adding a total row to my df. When I combine this total, bold it and try to use stylecolorbar it also selects the row total. How can I exclude the row total in this formatstyle.Below is my code so far

shinyApp(
  ui = fluidPage(fluidRow(column(
    12, DT::dataTableOutput('tbl')
  ))),
  server = function(input, output) {
    df <-
      structure(
        list(
          Language = c("C++", "Java", "Python"),
          Files = c(4009L,
                    210L, 35L),
          Overall = c(15328L, 876L, 200L)
        ),
        row.names = c(NA,-3L),
        class = "data.frame"
      )
   df <- transform(janitor::adorn_totals(df), Rate = Files/Overall * 100)
    
    irisReact <- reactive(df)
    dimIrisReact <- reactive(dim(df)[1])
    output$tbl = DT::renderDataTable(
      irisReact() %>% datatable() %>% formatStyle(
        0,
        target = "row",
        fontWeight = styleEqual(dimIrisReact(), "bold")
        # 'Overall',
        #           background = styleColorBar(df$Overall, 'lightblue'),
        #           backgroundSize = '98% 88%',
        #           backgroundRepeat = 'no-repeat',
        #           backgroundPosition = 'center'
      )
    )
  }
)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.