Skip to content

Commit 59bb1b1

Browse files
authored
Fix decorators (#854)
Closes #849
1 parent aa180de commit 59bb1b1

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.
@@ -1271,9 +1271,9 @@ srv_distribution <- function(id,
12711271
# Summary table listing has to be created separately to allow for qenv join
12721272
output_summary_q <- reactive({
12731273
if (iv_r()$is_valid()) {
1274-
within(common_q(), summary_table <- rlistings::as_listing(summary_table_data))
1274+
within(common_q(), summary_table <- DT::datatable(summary_table_data))
12751275
} else {
1276-
within(common_q(), summary_table <- rlistings::as_listing(summary_table_data[0L, ]))
1276+
within(common_q(), summary_table <- DT::datatable(summary_table_data[0L, ]))
12771277
}
12781278
})
12791279

@@ -1284,11 +1284,11 @@ srv_distribution <- function(id,
12841284
c(
12851285
common_q(),
12861286
within(test_q_out, {
1287-
test_table <- rlistings::as_listing(test_table_data)
1287+
test_table <- DT::datatable(test_table_data)
12881288
})
12891289
)
12901290
} else {
1291-
within(common_q(), test_table <- rlistings::as_listing(data.frame(missing = character(0L))))
1291+
within(common_q(), test_table <- DT::datatable(data.frame(missing = character(0L))))
12921292
}
12931293
})
12941294

@@ -1341,7 +1341,7 @@ srv_distribution <- function(id,
13411341
qq_r <- reactive(req(decorated_output_qq_q())[["qq_plot"]])
13421342

13431343
output$summary_table <- DT::renderDataTable(
1344-
expr = decorated_output_summary_q()[["summary_table_data"]],
1344+
expr = decorated_output_summary_q()[["summary_table"]],
13451345
options = list(
13461346
autoWidth = TRUE,
13471347
columnDefs = list(list(width = "200px", targets = "_all"))
@@ -1353,11 +1353,7 @@ srv_distribution <- function(id,
13531353
req(iv_r()$is_valid())
13541354
teal::validate_inputs(iv_r_dist())
13551355
req(test_q()) # Ensure original errors are displayed
1356-
DT::datatable(
1357-
data = decorated_output_test_q()[["test_table_data"]],
1358-
options = list(scrollX = TRUE),
1359-
rownames = FALSE
1360-
)
1356+
decorated_output_test_q()[["test_table"]]
13611357
})
13621358

13631359
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)