小编Nel*_*ieG的帖子

将 UI 插入 R闪亮模块服务器

我试图允许用户从另一个模块(ui_module1)添加在server_module2中看到的连续 UI 输出。因此,当他们点击按钮时,他们将看到 3 个 UI 对象:textOutput、sliderInput、textInput。我下面的代码在输出 UI 对象时停止。如果我不将它包装在第一个模块中,它就可以正常工作。

谢谢。

library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
library(shinyWidgets)
library(dplyr)

ui_module2 = function(id) {
  ns = NS(id)
  uiOutput(ns("finalOut"))
  
}

server_module2 = function(id) {
  moduleServer(id,
               function(input, output, session) {
                 output$finalOut = renderUI({
                   ns = session$ns
                   textOutput(p(style = "color: red", paste0("Package Num:", id, sep = "-")))
                   sliderInput("n", "N", 1, 1000, 500)
                   textInput("label", "Label")
                 })
               })
}

ui_module1 = function(id) {
  ns = NS(id)
  actionBttn(ns("actionbutton1"), "Press Button For New UI")
}

server_module1 = function(id) {
  moduleServer(id, …
Run Code Online (Sandbox Code Playgroud)

user-interface module r shiny shiny-reactivity

3
推荐指数
1
解决办法
629
查看次数

标签 统计

module ×1

r ×1

shiny ×1

shiny-reactivity ×1

user-interface ×1