3

could I make fileInput widget disappear after file input? Or could I get rid of the blue progress bar?

Thank you!

Arnab Nandy
  • 6,472
  • 5
  • 44
  • 50
Eileen
  • 97
  • 5

1 Answers1

3

Hello Stéphane Laurent answered a similar question in this post, with a minimal example it gives :

data("kyphosis", package = "rpart")
write.table(kyphosis, file = "kyphosis.txt", row.names = FALSE)


library(shiny)
runApp(list(
  ui = pageWithSidebar(
    headerPanel = headerPanel(" "),
    sidebarPanel = sidebarPanel( conditionalPanel(condition = "output.fileUploaded",
                                                  fileInput(inputId = "file_input", label = "Input" ) )),
    mainPanel = mainPanel( tableOutput(outputId = "table"))
  ),
  server = function(input, output) {

  getData <- reactive({
    if(is.null(input$file_input)) {
      return(NULL)
    } else {
      return(read.table(input$file_input$datapath, header = TRUE))
    }
  })

  output$fileUploaded <- reactive({
    return(is.null(getData()))
  })

  output$table <- renderTable({
    head(getData())
  })
  outputOptions(output, 'fileUploaded', suspendWhenHidden=FALSE)
  }
))
Community
  • 1
  • 1
Victorp
  • 13,636
  • 2
  • 51
  • 55