Skip to content

Commit 12f6071

Browse files
committed
fix: decorate datatables instead of listing_df
1 parent 8cd7d71 commit 12f6071

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

R/tm_g_distribution.R

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
#' This module generates the following objects, which can be modified in place using decorators::
3232
#' - `histogram_plot` (`ggplot2`)
3333
#' - `qq_plot` (`ggplot2`)
34-
#' - `summary_table` (`listing_df` created with [rlistings::as_listing()])
35-
#' - `test_table` (`listing_df` created with [rlistings::as_listing()])
34+
#' - `summary_table` (`datatables` created with [DT::datatable()])
35+
#' - `test_table` (`datatables` created with [DT::datatable()])
3636
#'
3737
#' A Decorator is applied to the specific output using a named list of `teal_transform_module` objects.
3838
#' The name of this list corresponds to the name of the output to which the decorator is applied.
@@ -1258,9 +1258,9 @@ srv_distribution <- function(id,
12581258
# Summary table listing has to be created separately to allow for qenv join
12591259
output_summary_q <- reactive({
12601260
if (iv_r()$is_valid()) {
1261-
within(common_q(), summary_table <- rlistings::as_listing(summary_table_data))
1261+
within(common_q(), summary_table <- DT::datatable(summary_table_data))
12621262
} else {
1263-
within(common_q(), summary_table <- rlistings::as_listing(summary_table_data[0L, ]))
1263+
within(common_q(), summary_table <- DT::datatable(summary_table_data[0L, ]))
12641264
}
12651265
})
12661266

@@ -1271,11 +1271,11 @@ srv_distribution <- function(id,
12711271
c(
12721272
common_q(),
12731273
within(test_q_out, {
1274-
test_table <- rlistings::as_listing(test_table_data)
1274+
test_table <- DT::datatable(test_table_data)
12751275
})
12761276
)
12771277
} else {
1278-
within(common_q(), test_table <- rlistings::as_listing(data.frame(missing = character(0L))))
1278+
within(common_q(), test_table <- DT::datatable(data.frame(missing = character(0L))))
12791279
}
12801280
})
12811281

@@ -1328,7 +1328,7 @@ srv_distribution <- function(id,
13281328
qq_r <- reactive(req(decorated_output_qq_q())[["qq_plot"]])
13291329

13301330
output$summary_table <- DT::renderDataTable(
1331-
expr = decorated_output_summary_q()[["summary_table_data"]],
1331+
expr = decorated_output_summary_q()[["summary_table"]],
13321332
options = list(
13331333
autoWidth = TRUE,
13341334
columnDefs = list(list(width = "200px", targets = "_all"))
@@ -1340,11 +1340,7 @@ srv_distribution <- function(id,
13401340
req(iv_r()$is_valid())
13411341
teal::validate_inputs(iv_r_dist())
13421342
req(test_q()) # Ensure original errors are displayed
1343-
DT::datatable(
1344-
data = decorated_output_test_q()[["test_table_data"]],
1345-
options = list(scrollX = TRUE),
1346-
rownames = FALSE
1347-
)
1343+
decorated_output_test_q()[["test_table"]]
13481344
})
13491345

13501346
pws1 <- teal.widgets::plot_with_settings_srv(

man/tm_g_distribution.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)