Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

255
Views
R rhandsontable change cell border in renderer

I have a short question regarding (r)handsontable. Is it possible to change cell borders using the renderer parameter of the hot_col function ? I tried to find something equivalent to td.style.background, but did not find anything on Google. I've tried things like td.style.border but it did not work...

If anyone has the answer, I would be grateful !

Thanks in advance

library(shiny)
library(rhandsontable)
ui <- fluidPage(
  rHandsontableOutput('table')
)
server <- function(input, output) {
  df <- data.frame(alphabet = letters[1:10],
                   include = TRUE,
                   include2 = FALSE)
  output$table <- rhandsontable::renderRHandsontable({
    col_highlight <- 2
    rhandsontable(df, height = 500) %>%
      hot_col(col_highlight,
              renderer = "             
              function (instance, td, row, col, prop, value, cellProperties) {
                    Handsontable.renderers.CheckboxRenderer.apply(this, arguments);
                    var col_value = instance.getData()[row][1]
                    if ( col_value ) {
                        td.style.background = '#C3FA9A';
                    } 
                    if ( !col_value) {
                        td.style.background ='#ff4d4d'
                    }}") })}
shinyApp(ui, server)
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The CSS property is backgroundColor:

output$table <- rhandsontable::renderRHandsontable({
    col_highlight <- 2
    rhandsontable(df, height = 500) %>%
        hot_col(
            col_highlight,
                renderer = "             
                    function (instance, td, row, col, prop, value, cellProperties) {
                            Handsontable.renderers.CheckboxRenderer.apply(this, arguments);
                            var col_value = instance.getData()[row][1];
                            td.style.backgroundColor = col_value ? 'red': 'green';
                            td.style.borderStyle = 'solid';
                            td.style.borderWidth = col_value ? '2px' : '4px';
                            td.style.borderColor = col_value ? 'yellow' : 'crimson';

                }"
        )
})
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!