Is it possible to have linked select input controls in R shiny. I currently have a dropdown to display the folders in a directory. I want a second dropdown to display the files in the folder selected. Is it possible?
Here is the ui.R:
shinyUI(pageWithSidebar(
sidebarPanel(
selectInput("Folder", "Folder:" , as.matrix(getFolders()),multiple = TRUE)
selectInput("FileInFolder", "File in folder:" ) # can this dropdown be linked to one above???
),
mainPanel(
))#end main
)
Here is the server.R
shinyServer(function(input, output) {})
Here is code to run it:
library(shiny)
runApp("C:/Users/me/Desktop/R Projects/FileFolder")
Here is my global.R file that populates the folders:
getFolders<-function()
{
folders<-list.dirs("//nas/mypath/",full.names= FALSE,recursive = FALSE)
folders
}
HERE is a fun ##How can I linkt his up to the getFolders so the UI is cascading?
getFilesInFolder<-function(Folder)
{
files<-list.files(paste("//nas/mypath/",Folder,sep=""))
files
}
Any idea how to make this work so the UI is cascading. That is when you select a folder from the folder dropdown the Files Dropdown is updated??
Thank you.