简体   繁体   中英

Shiny does not render uiOutput data in modules

I have this code:

columnSelectorUI <- function(id) {
  ns <- NS(id)
  return(
    wellPanel(
      h4("Select columns"),
      uiOutput(ns("tab"))
    ))
}

columnSelectorServer <- function(input, output, session) {
  print("XXX")
  state <- reactiveValues()
  print(renderUI({h2("hello")}))
  print(output)
  output$tab <- renderUI({div(HTML("hello"))})
}

What I see is that:

  • XXX is printed, so the server function is called
  • the h4 "selected columns" is rendered
  • the uiOutput element is rendered, but not its content.

<div id="columnSelector-tab" class="shiny-html-output shiny-bound-output"></div>

Solved: I was missing a ns() call in the top-level widget when it called the UI component.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM