Skip to content

Changing the header background color  #22

@FrankSchiro

Description

@FrankSchiro

Hi, I'm looking for an easy way to change the header background color.
Currently, I am doing a bunch of crazy things to change the background color of the header:

I altered the dq_render_handsontable function by adding this line
res$x$colHeaders <- headerHtml
Where, headerHtml is given as follows:

headerHtml <- c(
    "<div class='sample' style = 'background:#CEC; color = green; position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;'>My-Column-Name</div>
    "
)

This is the section of dq_render_handsontable which I had to alter:

app_output[[id]] <- rhandsontable::renderRHandsontable({
        if (is.null(hot())) 
            return()
        params[[1L]]$data <- hot()
        params[[1L]]$useTypes = FALSE #I added this
        params[[2L]]$hot <- do.call(rhandsontable::rhandsontable, 
            params[[1L]])
        res <- do.call(rhandsontable::hot_cols, params[[2L]])
        # result is an actual handson table with all the data next line #print will show in rstudio!
        ##print(res)

        for (x in params[[3L]]) {
            res <- do.call(rhandsontable::hot_col, append(list(res), 
                x))
        }
        for (x in params[[4L]]) {
            x$row <- match(x$row, rownames(hot()))
            x$row <- x$row[!is.na(x$row)]
            res <- do.call(dq_hot_cell, append(list(res), x))
        }
        res$dependencies <- append(res$dependencies, init())
        #res %>% hot_validate_numeric(cols = c(3), min = -50, max = 50)
        #res %>% myValidation(myNumericValidation)
        #res
        res$x$colHeaders <- headerHtml
        res
    })

So, while this will work for my given project, I'm wondering if there is a way to pass this into dq_render_handsontable as is? I tried passing colHeaders = headerHtml in table_param, col_param, cell_param, and cols_param, but it did not work and I got errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions