Is it possible to update the filename variable  the shinySaveButton from
the server?

I want to provide a default  filename based on a series of choices that the
user has made in the app ( here I have just made a random string to serve
the purpose.  how do I feed output$defaultname
 so that shinySaveButton( filename = outputSdefaultname )?


library(shiny)
library(shinyFiles)

data <- iris
roots <- c("UserFolder"=".")

ui <- fluidPage(
  actionButton("makeName","Make Default File Name"),
  shinySaveButton(id = "save", label = "Save file", title = "Save file as
...", filename = "defaultname",filetype=list(csv="csv"))
)


server <- shinyServer(function(input, output, session) {
  rv <- reactiveValues()
  observeEvent(input$makeName,{
    output$defaultname<-paste(letters[sample(1:10,5)],collapse="")
  })

  observe({


    shinyFileSave(input, "save", roots=roots, session=session)
    fileinfo <- parseSavePath(roots, input$save)
    xx<<-input$save
    if (nrow(fileinfo) > 0) {
      write.csv(, as.character(fileinfo$datapath))

    }
    session$allowReconnect("force")
  })
})

runApp(list(
  ui=ui,
  server=server
))

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to