Datatable, highlight rows & columns based on particular conditions


I understand from above link that we are able to use a particular column (V6) for condition, and highlight the other column (V1). For my case, I have more than one column for condition (Diff1, Diff4), and I want to highlight the other columns (Reco1, Speed1) based on Diff1 column, and other columns (Reco4, Speed4) based on Diff4 column.
As what is seen here attached.

My code is as below:

formatstyle_input <- c('Diff1','Diff4')
DT::datatable(UpdatedActualRecoScrewSpeed(),rownames = FALSE,options = list(paging = FALSE)) %>% 
          formatStyle(formatstyle_input,
          backgroundColor = styleInterval(c(0, 1, 2), c('#33FF33', 'yellow', 'orange','#FF6666')))

How should I modify my code for my needs? Also, after highlighting columns (Reco1, Speed1,Reco4,Speed4), is it possible to hide the columns (Diff1,Diff4)?
Thanks.

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.