0

i am using rhandsontable.

i want to use change color function of rhandsontable were it will change color of changed cell to "RED" if condition is not satisfied . i am new to R and don't know how can i do it . can anyone please help me?

walle_eva
  • 81
  • 6
  • What have you tried so far? What worked? What didn't? What type of data are you using? What does the table look like now? It looks like you're new to SO; welcome to the community! If you want great answers quickly, it's best to make your question reproducible. This includes sample data like the output from `dput()` or `reprex::reprex()` and any libraries you are using. Check it out: [making R reproducible questions](https://stackoverflow.com/q/5963269). – Kat Jan 12 '23 at 22:30

1 Answers1

0

For example, with the code below, all cells containing a numeric value >10 will be red:

        rhandsontable(df, height = 500) %>%
            hot_col(
                renderer = "             
                    function(instance, td, row, col, prop, value, cellProperties) {
                                Handsontable.renderers.NumericRenderer.apply(this, arguments);
                                if(value > 10) {
                                  td.style.backgroundColor = 'red';
                                }
                    }"
            )
Stéphane Laurent
  • 75,186
  • 15
  • 119
  • 225