简体   繁体   English

Shiny 不在模块中呈现 uiOutput 数据

[英]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打印了XXX,所以调用了服务器function
  • the h4 "selected columns" is rendered h4“选定的列”被渲染
  • the uiOutput element is rendered, but not its content. uiOutput 元素被渲染,但不是它的内容。

<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.已解决:当调用 UI 组件时,我在顶级小部件中缺少 ns() 调用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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