I am building an R application that allows the user to create and destroy Tabs at will. Each tab contains several selection box, a plot button, and a couple of plots after the plot button is clicked. The plotting takes a little time, so I don't want to create the plots each time a selection is changed on a tab, but I do want to clear the plots any time a selection on the tab is changed.
If I use observeEvent(input$itemOfInterest1, { }), every thing works correctly. Changing it to observeEvent(input[[paste0("itemOfInterest", tabNumber)]], { }) does not. TabNumber is a global variable and represents the active tab..
Adding to the selectInput code prevents the plots from ever being displayed, because the selectInput is usually called again (for some reason) after the plots are displayed.
Any ideas?
Thanks.