Hello! I have a large App which runs the same code on eight different inputs (.fcs files) and then outputs four graphs and two tables for each. I wanted to separate the Shiny App into tabs, but when I do the UI stops talking with the server. I am simplifying the server to just plot the number 10, and am removing some of the outputs/inputs.
Everything works correctly if i remove the navbarPage and tabPanel functions.
Thank you for your help!!!!
library(shiny)
library(flowCore)
library(flowMeans)
library(flowViz)
library(grid)
fcsGatingUI<-function(id) {
ns<-NS(id)
sidebarLayout(
sidebarPanel(
fileInput(ns("file"), label =ns("File"), multiple = FALSE, accept = ".FCS", buttonLabel ="Browse")
),
mainPanel(
fluidRow(column
(width=6,tableOutput(ns("meta")), tableOutput(ns("data"))),
column
(width=6, plotOutput(ns("plotFSC")))
))
)
}
ui <- navbarPage("CD54 Automatic Flow Gating", theme= bslib::bs_theme(bootswatch="superhero"),
tabPanel("Day 0", fluidPage(
titlePanel("CD54 Automated Flow Gating - Day 0"),
textInput("sample", label="Enter product lot number"),
downloadButton("export", label = "Generate report"),
downloadButton("csv", label= "Downlaod CSV"),
fcsGatingUI("APH CD54"),
fcsGatingUI("APH Isotype")
)),
tabPanel("Day 2", fluidPage(
titlePanel("CD54 Automated Flow Gating - Day 2"),
textInput("sample", label="Enter product lot number"),
downloadButton("export", label = "Generate report"),
downloadButton("csv", label= "Downlaod CSV"),
fcsGatingUI("FP CD54"),
fcsGatingUI("FP Isotype"),
))
)
fcsGatingServer <- function(id) {
moduleServer(
id,
function(input, output, session) {
vals <- reactiveValues(plotFSC=NULL)
output$plotFSC <- renderPlot({
plot(10)
vals$plotFSC
})
})
}
server <- function(input, output, session) {
options(shiny.maxRequestSize=30*1024^2)
v1 <- fcsGatingServer("APH CD54")
v2 <- fcsGatingServer("APH Isotype")
v7 <- fcsGatingServer("FP CD54")
v8 <- fcsGatingServer("FP Isotype")
}
shinyApp(ui, server)
#If any plots show up then the problem will be fixed. Thank you so much for looking into this