shinyJsTutorials
shinyJsTutorials copied to clipboard
ordering problem of the FrissIntroJSBasic package for various TabPanels in ShinyApp
When there are some more Tabpanels in the ShinyApp, the help button makes the same presentation for all of them. Are there any parameters to pair the related Tabpanels with the correct elements in the help.csv?
To solve this I used an observeEvent in server.R and create for each TabPanel a .csv file.
server.R
# listen to the action button
observeEvent(input$startHelp,{
# Index help data into right tab
indTab <- names(helpData)==input$sidebarmenu
initIntroJS(session, helpData[[names(helpData)[indTab]]])
})
Global.R
helpDir : Help directory where are all the .csv files
helpData <- loadHelpContent()
loadHelpContent <- function(helpDir){
helpFiles <- dir(helpDir,"csv")
helpNames <- lapply(helpFiles,function(x){substr(x,0,nchar(x)-4)})
helpData <- list()
nHelpFiles <- length(helpFiles)
if(nHelpFiles==0) return(list())
for(i in 1:nHelpFiles){ helpFile <- paste0(helpDir,"/",helpFiles[i])
tmpHelpData <- read.csv2(helpFile,1,stringsAsFactors=FALSE)
helpData[[helpNames[[i]]]] <- tmpHelpData
}
return(helpData)