Skip to content

Commit

Permalink
add reset data button
Browse files Browse the repository at this point in the history
  • Loading branch information
d-callan committed Dec 2, 2023
1 parent 507bf74 commit 062fcfc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
17 changes: 17 additions & 0 deletions R/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,23 @@ server <- function(input, output, session) {
correlationMatrix <- shiny::reactiveValues(corr_matrix = NULL)
pValuesMatrix <- shiny::reactiveValues(p_values = NULL)

output$file1 <- renderUI({
input$resetData ## Create a dependency with the reset button
shiny::fileInput("fileUpload", shiny::strong("Upload Data Table"), accept = c(".tab", "tsv",".rds"))
})

output$file2 <- renderUI({
input$resetData
shiny::fileInput("fileUpload2", shiny::strong("Upload Second Data Table (optional)"), accept = c(".tab", "tsv",".rds"))
})

shiny::observeEvent(input$resetData, {
data1$matrix <- NULL
data2$matrix <- NULL
correlationMatrix$corr_matrix <- NULL
pValuesMatrix$p_values <- NULL
})

shiny::observeEvent({
input$fileUpload
input$fileUpload2
Expand Down
5 changes: 3 additions & 2 deletions R/ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ ui <- shiny::fluidPage(
shiny::fluidRow(
shiny::column(3,
shiny::wellPanel(
shiny::fileInput("fileUpload", shiny::strong("Upload Data Table"), accept = c(".tab", "tsv",".rds")),
shiny::fileInput("fileUpload2", shiny::strong("Upload Second Data Table (optional)"), accept = c(".tab", "tsv",".rds")),
uiOutput('file1'),
uiOutput('file2'),
shiny::actionButton("resetData", shiny::strong("Reset Data")),
shiny::hr(),
#div(style="display:inline-block",
selectInput("correlationMethod", shiny::strong("Correlation Method:"),
Expand Down

0 comments on commit 062fcfc

Please sign in to comment.