Hi all
I would like to find some idea to help me on the following point :
In my ShinyApp, I have a global variable from which I build some summaries and graphs in tabPanels.
This variable may be modified by a click on an ActionButton.
I would like that all graphs and text be updated when a change in this variable has been detected
Here is an extract of my code in server.R :
Server.R
shinyServer(function(input, output, session) {
#initialisation of 'obj' variable
obj <- read.csv("file") # current obj which may be modified
original <- read.csv("file") ## backup of the original variable
#------ to return to the original object---------------
observe({
input$GetOriginalDataButton
if (input$GetOriginalDataButton == 0) {
return(NULL)
}
obj <<- objOriginal
}
#---------- view the content of the variable 'obj' --------------------------#
output$MSnsetView <- renderPrint({
input$GetOriginalDataButton
if (input$openVisualiseButton == 0) {return(NULL)}
obj
})
#------------ modification of the variable -------------------------#
observe({
input$ValidateFilters
if (input$ValidateFilters == 0) {return(NULL) }
#code to modify the variable
obj <-- NewValue
)}
}
ui.R
[...]
actionButton("ValidateFilters","Valider les filtres"),
actionButton("GetOriginalDataButton","Retour aux donnees originales")
main(
tabPanel(title="Open", value = "open", verbatimTextOutput("MSnsetView"))
)
[...]
The first time I click on ValidateFilters, obj is modified and the new variable is shown in the tabPanel MSnsetView. Then, I click on GetOriginalDataButton to return to the original data, the tabPanel is updated correctly. But, from now, each time I click on ValidateFilters, the object 'obj' seems to be correctly updated but the tabPanel is not updated. And I do not undersatnd why.
Is there somebody who can help me ?
Regards
Sam