Passing uiOutput between nested modules

Hi,

In my app, I have two modules (nested) for which I want to pass uiOuput. In the example below, the output named "screen1" (created in the outer module)has to be passed to the inner module where it will be displayed. But It doesn't work..
Passing such uiOutput work from the original shinyApp to one module but I can't make it works between two modules.

innerUI <- function(id){
ns <- NS(id)

tagList(
  h4("Inner module"),
  uiOutput(ns('displayScreens'))
  )
}



inner <- function(input, output, session, params){

    output$displayScreens <- renderUI({
        params()
 })
}


outerUI <- function(id){
  ns <- NS(id)
  innerUI(ns('test1'))
}

outer <- function(input, output, session){

  rv <- reactiveValues(
    test = uiOutput("screen1")
  )

  callModule(inner, 'test1', params= reactive({rv$test}))


  output$screen1 <- renderUI({
    h4("I am the screen 1 !")
  })

}

ui <- fluidPage(
  outerUI('test2')
)

server <- function(input, output, session){
  callModule(outer, 'test2')
}

shinyApp(ui=ui, server=server)

If I'm reading your code correctly, all fo the outputs are hooked up correctly. However, the innerUI tagList is not being added to the final UI.

In https://shiny.rstudio.com/articles/modules.html#using-modules, you can see the csvFile module in the server function is matching to the csvFileInput module in the UI.

Two ways I can think of fixing this:

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.