Skip to content

Commit

Permalink
Updating the fix
Browse files Browse the repository at this point in the history
Also fixed download buttons in Cohorts module, addressing #298
  • Loading branch information
nhall6 committed Sep 9, 2024
1 parent 4c3bcd9 commit 79518c1
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 70 deletions.
136 changes: 72 additions & 64 deletions R/cohort-generator-main.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,35 +64,41 @@ cohortGeneratorViewer <- function(id) {
collapsible = T,
collapsed = F,
width = '100%',
title = shiny::span( shiny::icon("file-arrow-down"),'Download Data'),
#solidHeader = TRUE,

shiny::downloadButton(
ns('downloadCohortCountsFull'),
label = "Download (Full)",
icon = shiny::icon("download")
),

shiny::actionButton(
ns('downloadCohortCountsFiltered'),
label = "Download (Filtered)",
icon = shiny::icon("download"),
onclick = paste0("Reactable.downloadDataCSV('", ns('cohortCounts'),
"', 'cohort-count-data-filtered-", Sys.Date(), ".csv')")
)
),
# title = shiny::span( shiny::icon("file-arrow-down"),'Download Data'),
# #solidHeader = TRUE,
#
# shiny::downloadButton(
# ns('downloadCohortCountsFull'),
# label = "Download (Full)",
# icon = shiny::icon("download")
# ),
#
# shiny::actionButton(
# ns('downloadCohortCountsFiltered'),
# label = "Download (Filtered)",
# icon = shiny::icon("download"),
# onclick = paste0("Reactable.downloadDataCSV('", ns('cohortCounts'),
# "', 'cohort-count-data-filtered-", Sys.Date(), ".csv')")
# )
# ),

shinydashboard::box(
width = '100%',
title = shiny::span( shiny::icon("table"), 'Counts Table'),
#solidHeader = TRUE,

shiny::uiOutput(ns("selectColsCohortCounts")
),

reactable::reactableOutput(
outputId = ns("cohortCounts")
)
# shinydashboard::box(
# width = '100%',
# title = shiny::span( shiny::icon("table"), 'Counts Table'),
# #solidHeader = TRUE,
#
# shiny::uiOutput(ns("selectColsCohortCounts")
# ),
#
# reactable::reactableOutput(
# outputId = ns("cohortCounts")
# )
# )

resultTableViewer(
ns("cohortCounts"),
downloadedFileName = "cohortCountsTable-"
)
)
),

Expand All @@ -103,29 +109,30 @@ cohortGeneratorViewer <- function(id) {
collapsible = T,
collapsed = F,
width = '100%',
title = shiny::span( shiny::icon("file-arrow-down"),'Download Data'),
#solidHeader = TRUE,
# title = shiny::span( shiny::icon("file-arrow-down"),'Download Data'),
# #solidHeader = TRUE,
#
# shiny::downloadButton(
# ns('downloadCohortGeneration'),
# label = "Download",
# icon = shiny::icon("download")
# )
# ),
#
# shinydashboard::box(
# status = 'info',
# width = '100%',
# title = shiny::span( shiny::icon("table"), 'Generation Table'),
# #solidHeader = TRUE,
#
# shiny::uiOutput(ns("selectColsCohortGeneration")
# ),

shiny::downloadButton(
ns('downloadCohortGeneration'),
label = "Download",
icon = shiny::icon("download")
)
),

shinydashboard::box(
status = 'info',
width = '100%',
title = shiny::span( shiny::icon("table"), 'Generation Table'),
#solidHeader = TRUE,

shiny::uiOutput(ns("selectColsCohortGeneration")
),

reactable::reactableOutput(
outputId = ns("cohortGeneration")
)
resultTableViewer(
ns("cohortGeneration"),
downloadedFileName = "cohortGenerationTable-"
)
)
),

shiny::tabPanel(
Expand All @@ -148,20 +155,20 @@ cohortGeneratorViewer <- function(id) {

shiny::uiOutput(ns("inputsText")),

shinydashboard::box(
collapsible = T,
collapsed = F,
width = '100%',
title = shiny::span( shiny::icon("file-arrow-down"),'Download Data'),
#solidHeader = TRUE,

shiny::downloadButton(
ns('downloadAttritionTable'),
label = "Download",
icon = shiny::icon("download")
)
),

# shinydashboard::box(
# collapsible = T,
# collapsed = F,
# width = '100%',
# title = shiny::span( shiny::icon("file-arrow-down"),'Download Data'),
# #solidHeader = TRUE,
#
# shiny::downloadButton(
# ns('downloadAttritionTable'),
# label = "Download",
# icon = shiny::icon("download")
# )
# ),
#


shinydashboard::box(
Expand All @@ -173,7 +180,8 @@ cohortGeneratorViewer <- function(id) {
# shiny::uiOutput(ns("selectColsCohortAttrition")
# ),

resultTableViewer(ns('attritionTable'))
resultTableViewer(ns('attritionTable'),
downloadedFileName = "cohortAttritionTable-")
),

shinydashboard::box(
Expand Down
6 changes: 0 additions & 6 deletions R/components-data-viewer.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@
#' @return shiny module UI
#' @family {Utils}

convertToDataFrame <- function(x, session, inputname) {
do.call("rbind.data.frame", x)
}

registerInputHandler("to_csv", convertToDataFrame, force = TRUE)

filteredDownloadButton <- function(tableId, label = "Download (Filtered)", filename = "filteredData.csv", icon = shiny::icon("download")) {
tags$div(class = "col-sm-3",
htmltools::tags$button(
Expand Down

0 comments on commit 79518c1

Please sign in to comment.