Shiny- DT: dynamic format Style

I am trying to use an editable DT table in shiny.
The cells should be highlighted according to some rules (in this instance, the cells of V1 are highlighted when "new" equals 0 or 1).

However, I cannot make it work dynamically: when the user edits the values, the highlighted cells remain unchanged. Should I use a reactive and how?

Here is my short code:

library(shiny)
library(DT)

shinyApp(
  ui = fluidPage(DTOutput('tbl')),

  server = function(input, output) {

df = as.data.frame(cbind(matrix(round(rnorm(50), 3), 10)))
df$new=rownames(df)
    
    output$tbl=   renderDataTable({
      
      datatable(df, editable = T)%>% 
        formatStyle(
        'V1', 'new',
        backgroundColor = styleEqual(c(0, 1), c('gray', 'yellow'))
      )
      
      })

Thank you for your help!

PS: I asked that also on SO:

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.