Skip to content

Commit b2652fb

Browse files
committed
add Show R Code
1 parent b9c0227 commit b2652fb

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

R/tm_data_table.R

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#'
3232
#' @section Decorating `tm_data_table`:
3333
#'
34-
#' This module creates below objects that can be modified with decorators:
34+
#' This module generates the following objects, which can be modified in place using decorators:
3535
#' - `table` (`DT::datatable`)
3636
#'
3737
#' For additional details and examples of decorators, refer to the vignette
@@ -187,6 +187,9 @@ ui_page_data_table <- function(id,
187187
)
188188
)
189189
),
190+
forms = tagList(
191+
teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code")
192+
),
190193
pre_output = pre_output,
191194
post_output = post_output
192195
)
@@ -374,5 +377,12 @@ srv_data_table <- function(id,
374377
# no table is displayed
375378
decorated_data_table_data()[["table"]]
376379
})
380+
381+
teal.widgets::verbatim_popup_srv(
382+
id = "rcode",
383+
verbatim_content = reactive(teal.code::get_code(req(decorated_data_table_data()))),
384+
title = "R Code for PCA"
385+
)
386+
377387
})
378388
}

0 commit comments

Comments
 (0)