shinyJsTutorials icon indicating copy to clipboard operation
shinyJsTutorials copied to clipboard

ordering problem of the FrissIntroJSBasic package for various TabPanels in ShinyApp

Open AhuPersonal opened this issue 7 years ago • 1 comments

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?

AhuPersonal avatar Jun 16 '17 16:06 AhuPersonal

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)

Hendjy avatar Jul 05 '21 08:07 Hendjy