Skip to content

Commit

Permalink
Merge branch 'master' into add-cols-nanoplot-example
Browse files Browse the repository at this point in the history
  • Loading branch information
rich-iannone authored Jun 19, 2024
2 parents f6732cf + 0061af8 commit 840fb09
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 5 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# gt (development version)

* `opt_interactive()` gains `height` to help specify your widget's height (@olivroy, #1544).

* `opt_interactive()` now shows row names if `rownames_to_stub = TRUE` (@olivroy, #1702).

* `data_color()` throws a more informative error message if `rows` didn't resolve to anything (@olivroy, #1659).
Expand Down
1 change: 1 addition & 0 deletions R/dt_options.R
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ dt_options_tbl <-
"container_overflow_x", FALSE, "container", "overflow","auto",
"container_overflow_y", FALSE, "container", "overflow","auto",
"ihtml_active", FALSE, "interactive", "logical", FALSE,
"ihtml_height", FALSE, "interactive", "px", "auto",
"ihtml_use_pagination", FALSE, "interactive", "logical", TRUE,
"ihtml_use_pagination_info", FALSE, "interactive", "logical", TRUE,
"ihtml_use_sorting", FALSE, "interactive", "logical", TRUE,
Expand Down
11 changes: 9 additions & 2 deletions R/opts.R
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ get_colorized_params <- function(
#' - `ihtml.page_size_default`
#' - `ihtml.page_size_values`
#' - `ihtml.pagination_type`
#' - `ihtml.height`
#'
#' @inheritParams fmt_number
#'
Expand Down Expand Up @@ -333,6 +334,10 @@ get_colorized_params <- function(
#' with a stepper for the page number. With `"simple"`, only the 'previous'
#' and 'next' buttons are displayed.
#'
#' @param height *Height of interactive HTML table*
#'
#' Height of the table in pixels. Defaults to `"auto"` for automatic sizing.
#'
#' @return An object of class `gt_tbl`.
#'
#' @section Examples:
Expand Down Expand Up @@ -413,7 +418,8 @@ opt_interactive <- function(
use_page_size_select = FALSE,
page_size_default = 10,
page_size_values = c(10, 25, 50, 100),
pagination_type = c("numbers", "jump", "simple")
pagination_type = c("numbers", "jump", "simple"),
height = "auto"
) {

# Perform input object validation
Expand All @@ -436,7 +442,8 @@ opt_interactive <- function(
ihtml.use_page_size_select = use_page_size_select,
ihtml.page_size_default = page_size_default,
ihtml.page_size_values = page_size_values,
ihtml.pagination_type = pagination_type
ihtml.pagination_type = pagination_type,
ihtml.height = height
)
}

Expand Down
3 changes: 2 additions & 1 deletion R/render_as_i_html.R
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ render_as_ihtml <- function(data, id) {

# Get options settable in `tab_options()`
opt_val <- dt_options_get_value
height <- opt_val(data = data, option = "ihtml_height")
use_pagination <- opt_val(data = data, option = "ihtml_use_pagination")
use_pagination_info <- opt_val(data = data, option = "ihtml_use_pagination_info")
use_search <- opt_val(data = data, option = "ihtml_use_search")
Expand Down Expand Up @@ -505,7 +506,7 @@ render_as_ihtml <- function(data, id) {
rowStyle = NULL,
fullWidth = TRUE,
width = table_width,
height = "auto",
height = height,
theme = tbl_theme,
language = lang_defs,
elementId = id,
Expand Down
5 changes: 5 additions & 0 deletions R/tab_create_modify.R
Original file line number Diff line number Diff line change
Expand Up @@ -4347,6 +4347,10 @@ set_style.cells_source_notes <- function(loc, data, style) {
#' page number. With `"simple"`, only the 'previous' and 'next' buttons are
#' displayed.
#'
#' @param ihtml.height *Height of interactive HTML table*
#'
#' Height of the table in pixels. Defaults to `"auto"` for automatic sizing.
#'
#' @param page.orientation *Set RTF page orientation*
#'
#' For RTF output, this provides an two options for page
Expand Down Expand Up @@ -4711,6 +4715,7 @@ tab_options <- function(
ihtml.page_size_default = NULL,
ihtml.page_size_values = NULL,
ihtml.pagination_type = NULL,
ihtml.height = NULL,
page.orientation = NULL,
page.numbering = NULL,
page.header.use_tbl_headings = NULL,
Expand Down
8 changes: 7 additions & 1 deletion man/opt_interactive.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions man/tab_options.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/helper-gt_attr_expectations.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ expect_tab <- function(tab, df) {

dt_options_get(data = tab) %>%
dim() %>%
expect_equal(c(190, 5))
expect_equal(c(191, 5))

dt_transforms_get(data = tab) %>%
expect_length(0)
Expand Down

0 comments on commit 840fb09

Please sign in to comment.