Skip to content

Conversation

@rich-iannone
Copy link
Member

@rich-iannone rich-iannone commented Apr 27, 2020

This simply moves the .gt_striped rule below others to increase precedence.

Thanks @gergness for creating the PR that prompted this one (#537). We ultimately decided to go with this change (which restores the earlier behavior) since it work better with HTML style inlining (using as_raw_html()).

Testable code from @gergness, where the yellow row stripes are also present in the stub cells (leftmost column).

library(gt)

exibble %>% 
  gt(rowname_col = "row") %>% 
  opt_row_striping() %>% 
  tab_options(
    row.striping.include_stub = TRUE,
    row.striping.background_color = "yellow"
  )

striping_in_stub

Fixes: #536

jcheng5
jcheng5 previously approved these changes Apr 27, 2020
jcheng5
jcheng5 previously approved these changes Apr 29, 2020
@markbneal
Copy link

markbneal commented Jun 11, 2020

If you need this working in a hurry (like I do), and its not yet in the released version, replace the gt_styles_default.scss file on your computer with the one on the branch that fixes this, from: https://github.com/rstudio/gt/blob/restore-row-striping-stub/inst/css/gt_styles_default.scss

Another handy hint - if you are using gt row striping in a gitbook format (e.g. with bookdown) and the row striping is going a bit strange (e.g. grey where you weren't expecting it), you may need to change the default 'plugin-table.css' on your computer, and change the striping colour there to something that won't cause a problem - e.g. I changed table tr:nth-child(2n){background-color:#f8f8f8} to table tr:nth-child(2n){background-color:#fff}, which meant it is now white instead of grey. Note that the way gt counts every second row is different to how the bookdown default css counts every second row when you have row grouping.

* master:
  Refactor `data_color()` so that it executes faster (#576)
  Update R-CMD-check.yaml (#599)
  Release gt 0.2.1 (#588)
  Ensure that row ordering doesn't affect summary row calculations (#556)
  Update failing example (#586)
  Remove test of scales behaviour
  Squelch warnings from tibble 3.0.0/3.0.1 (#557)
  Bump cache on pkgdown.yaml for GH workflow (#570)
  Update GH Actions workflow for R CMD check (#568)
  Update Description of package to be less confusing (#569)
@rich-iannone rich-iannone requested a review from jcheng5 June 22, 2020 18:51
@rich-iannone rich-iannone merged commit fa66dd9 into master Jun 22, 2020
@rich-iannone rich-iannone deleted the restore-row-striping-stub branch June 22, 2020 19:08
rich-iannone added a commit that referenced this pull request Jun 22, 2020
* master:
  Restore row striping option in stub cells (`row.striping.include_stub = TRUE`) (#564)
  Refactor `data_color()` so that it executes faster (#576)
  Update R-CMD-check.yaml (#599)
  Release gt 0.2.1 (#588)
  Ensure that row ordering doesn't affect summary row calculations (#556)
  Update failing example (#586)
  Remove test of scales behaviour
rich-iannone added a commit that referenced this pull request Jun 22, 2020
* master:
  Add `scale_values` arg to `fmt_percent()` (#565)
  Restore row striping option in stub cells (`row.striping.include_stub = TRUE`) (#564)
  Refactor `data_color()` so that it executes faster (#576)
  Update R-CMD-check.yaml (#599)
  Release gt 0.2.1 (#588)
rich-iannone added a commit that referenced this pull request Jun 22, 2020
* master:
  Fix issues with defining column widths in `cols_width()` (#561)
  Add `scale_values` arg to `fmt_percent()` (#565)
  Restore row striping option in stub cells (`row.striping.include_stub = TRUE`) (#564)
  Refactor `data_color()` so that it executes faster (#576)
  Update R-CMD-check.yaml (#599)
  Release gt 0.2.1 (#588)
  Ensure that row ordering doesn't affect summary row calculations (#556)
  Update failing example (#586)
  Remove test of scales behaviour
  Squelch warnings from tibble 3.0.0/3.0.1 (#557)
  Bump cache on pkgdown.yaml for GH workflow (#570)
  Update GH Actions workflow for R CMD check (#568)
  Update Description of package to be less confusing (#569)
rich-iannone added a commit that referenced this pull request Oct 13, 2020
* master:
  Rewrite of RTF building functions and `as_rtf()` (#638)
  v0.2.2 Release Candidate (#629)
  Settable font options (#591)
  Add options for sig figs / inclusion of trailing dec marks (#546)
  Fix issues with defining column widths in `cols_width()` (#561)
  Add `scale_values` arg to `fmt_percent()` (#565)
  Restore row striping option in stub cells (`row.striping.include_stub = TRUE`) (#564)
  Refactor `data_color()` so that it executes faster (#576)
  Update R-CMD-check.yaml (#599)
  Release gt 0.2.1 (#588)
  Ensure that row ordering doesn't affect summary row calculations (#556)
rich-iannone added a commit that referenced this pull request Oct 25, 2020
* master: (30 commits)
  Spanner alignment correction (#662)
  PEN currency fix (#663)
  Fix for `gtsave()` when saving an image and specifying a `path` value (#592)
  Rewrite of RTF building functions and `as_rtf()` (#638)
  v0.2.2 Release Candidate (#629)
  Settable font options (#591)
  Add options for sig figs / inclusion of trailing dec marks (#546)
  Fix issues with defining column widths in `cols_width()` (#561)
  Add `scale_values` arg to `fmt_percent()` (#565)
  Restore row striping option in stub cells (`row.striping.include_stub = TRUE`) (#564)
  Refactor `data_color()` so that it executes faster (#576)
  Update R-CMD-check.yaml (#599)
  Release gt 0.2.1 (#588)
  Ensure that row ordering doesn't affect summary row calculations (#556)
  Update failing example (#586)
  Remove test of scales behaviour
  Squelch warnings from tibble 3.0.0/3.0.1 (#557)
  Bump cache on pkgdown.yaml for GH workflow (#570)
  Update GH Actions workflow for R CMD check (#568)
  Update Description of package to be less confusing (#569)
  ...
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

Successfully merging this pull request may close these issues.

stubs are not striped even when row.striping.include_stub = TRUE

4 participants