diff --git a/CHANGELOG.md b/CHANGELOG.md index 024fb6e..20259c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] 2025-12-09 ### Updated -- The key metrics table is now in long format to avoid horizontal scrolling with high number of samples. +- The key metrics table is now in long format to avoid horizontal scrolling with high number of samples. Pagination has also been added to prevent very long tables from being displayed. ### Fixed - The ES now tolerates chunk errors and will in most cases render a report even if some chunks fail. diff --git a/R/key_table.R b/R/key_table.R index f73e942..865de49 100644 --- a/R/key_table.R +++ b/R/key_table.R @@ -389,7 +389,8 @@ key_metric_table <- table_content %>% style_table( escape = FALSE, - tooltips = TRUE + tooltips = TRUE, + pageLength = 10 ) } diff --git a/R/tables.R b/R/tables.R index 09b6a1b..8d9d5e4 100644 --- a/R/tables.R +++ b/R/tables.R @@ -43,7 +43,9 @@ style_table <- function( pixelatorR:::assert_single_value(buttons, "bool") # Options - opts <- list(pageLength = ifelse(is.null(pageLength), nrow(df), pageLength)) + opts <- list( + pageLength = ifelse(is.null(pageLength), nrow(df), pageLength) + ) dom <- "" @@ -103,16 +105,22 @@ style_table <- function( ") } - opts$dom <- dom + # Build extensions list + extensions <- c() + if (buttons) extensions <- c(extensions, "Buttons") + if (length(extensions) == 0) extensions <- list() + table_widget <- DT::datatable( df, caption = caption, rownames = FALSE, escape = escape, options = opts, - extensions = if (buttons) "Buttons" else list(), + extensions = extensions, + class = "display compact", + width = "100%", ... )