Hello all,
I'm writing an rshiny program, where I need to upload multiple excel files in 3 different batches. For that I have 3 fileinput() functions(for e.g., file1, file2 and file3) in the intial page load.
But, I don't want to display all three in the intial page load.
During the Intial load, it should display only file1, after sucessfull load it should display a pop-up message, after clicking on the "OK" it have to show file2 and disable editing of file1 browse button. How can I achieve this functionality? I'm loosing myself as I'm new to Rshiny
Following is the code I have been trying:
ui.r
ui <- fluidPage(
# App title ----
titlePanel("Uploading Files"),
# Sidebar layout with input and output definitions ----
sidebarLayout(
# Sidebar panel for inputs ----
sidebarPanel(
# Input: Select a file ----
fileInput("file1", "Choose file1 for upload", multiple = TRUE, accept = c(".xlsx", ".xls", ".csv")),
tags$hr(),
conditionalPanel(condition = "input.file == 'f1loadcompleted'",
fileInput("file2", "Choose 2 files for upload", multiple = TRUE, accept = c(".xlsx", ".xls", ".csv"))),
tags$hr(),
conditionalPanel(condition = "input.file == 'f1 & f2 load completed'",
fileInput("file3", "Choose 3 files for upload", multiple = TRUE, accept = c(".xlsx", ".xls", ".csv"))),
tags$hr(),
),
# Main panel for displaying outputs ----
mainPanel(
tableOutput("contents")
)
)
)
server.r
server <- function(input, output) {
output$contents <- renderTable({
req(input$file1)
df1 = input$file1
df1$SubString <- data.frame(substring(df1$name, 1, 3))
# functionality of f1 which is working absolutely fine
#
shinyalert("Please load SCORE INFORMATION files", "Originals load completed", type = "info")
file <- "f1loadcompleted"
if(input$file == "f1loadcompleted"){
file <- input$file2
}
req(input$f2)
df2= input$file2
df2$SubString <- data.frame(substring(df2$name, 1, 3))
)}}