|
21 | 21 | #' - `box_plot` (`ggplot2`) |
22 | 22 | #' - `density_plot` (`ggplot2`) |
23 | 23 | #' - `cumulative_plot` (`ggplot2`) |
24 | | -#' - `table` ([DT::datatable()]) |
| 24 | +#' - `table` (`listing_df` created with [rlistings::as_listing()]) |
25 | 25 | #' |
26 | 26 | #' Decorators can be applied to all outputs or only to specific objects using a |
27 | 27 | #' named list of `teal_transform_module` objects. |
@@ -719,15 +719,10 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, |
719 | 719 | within(qenv, summary_table <- data.frame()) |
720 | 720 | } |
721 | 721 |
|
722 | | - # Datatable is generated in qenv to allow for output decoration |
| 722 | + # Generate decoratable object from data |
723 | 723 | qenv <- within(qenv, { |
724 | | - table <- DT::datatable( |
725 | | - summary_table, |
726 | | - options = list( |
727 | | - dom = "t", |
728 | | - autoWidth = TRUE, |
729 | | - columnDefs = list(list(width = "200px", targets = "_all")) |
730 | | - ) |
| 724 | + table <- rlistings::as_listing( |
| 725 | + tibble::rownames_to_column(summary_table, var = " ") |
731 | 726 | ) |
732 | 727 | }) |
733 | 728 |
|
@@ -1044,7 +1039,14 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, |
1044 | 1039 | if (iv_r()$is_valid()) { |
1045 | 1040 | categorical_var <- as.vector(merged$anl_input_r()$columns_source$categorical_var) |
1046 | 1041 | if (!is.null(categorical_var)) { |
1047 | | - decorated_final_q()[["table"]] |
| 1042 | + DT::datatable( |
| 1043 | + decorated_final_q()[["summary_table"]], |
| 1044 | + options = list( |
| 1045 | + dom = "t", |
| 1046 | + autoWidth = TRUE, |
| 1047 | + columnDefs = list(list(width = "200px", targets = "_all")) |
| 1048 | + ) |
| 1049 | + ) |
1048 | 1050 | } |
1049 | 1051 | } |
1050 | 1052 | } |
@@ -1319,7 +1321,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, |
1319 | 1321 | ) |
1320 | 1322 | categorical_var <- as.vector(merged$anl_input_r()$columns_source$categorical_var) |
1321 | 1323 | if (length(categorical_var) > 0) { |
1322 | | - summary_table <- common_code_q()[["summary_table"]] |
| 1324 | + summary_table <- decorated_final_q()[["table"]] |
1323 | 1325 | card$append_text("Summary Table", "header3") |
1324 | 1326 | card$append_table(summary_table) |
1325 | 1327 | } |
|
0 commit comments