Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing the header background color #22

Open
FrankSchiro opened this issue Nov 25, 2020 · 0 comments
Open

Changing the header background color #22

FrankSchiro opened this issue Nov 25, 2020 · 0 comments

Comments

@FrankSchiro
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant