From e48b160959e9892a1ecdf9e1cc6be30dba23bf73 Mon Sep 17 00:00:00 2001 From: yilong zhang Date: Thu, 11 Apr 2024 17:51:51 +0000 Subject: [PATCH] provide source data as a dataframe --- R/reactable2.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/reactable2.R b/R/reactable2.R index ec0554a..9b26a78 100644 --- a/R/reactable2.R +++ b/R/reactable2.R @@ -50,15 +50,15 @@ reactable2 <- function(data, if (download) { on_click <- paste0("Reactable.downloadDataCSV('", element_id, "')") - htmltools::browsable( + tbl <- htmltools::browsable( htmltools::tagList( htmltools::tags$button("Download as CSV", onclick = on_click), tbl ) ) - } else { - tbl } + attr(tbl, "data") <- tbl$data + } #' Convert reactable to a data frame