小编pol*_*pik的帖子

如何从另一个闪亮模块更新闪亮模块中的输入?

我有两个闪亮的模块,updateTextInput()一个是。当单击第一个模块的按钮时,我想textInput()第二个模块中进行更新。我知道这是因为这些模块位于不同的命名空间中,但我不知道如何通信模块。

代表如下:)

library(shiny)

firstUI <- function(id) {
  ns <- NS(id)
  tagList(
    actionButton(ns("update"), "Update 1st and 2nd module"),
    textInput(ns("first"), "Update me pls1", value = "Clear me!")
    
  )
}
firstServer <- function(id) {
  moduleServer(id, function(input, output, session) {
    observeEvent(input$update, {
      updateTextInput(session = session, "first", value = "")
      updateTextInput(session = session,"second", value = "")
    })
})
}
secondUI <- function(id) {
  ns <- NS(id)
  tagList(
    textInput(ns("second"), "Update me pls", value = "Clear me!") …
Run Code Online (Sandbox Code Playgroud)

r shiny

6
推荐指数
1
解决办法
1153
查看次数

标签 统计

r ×1

shiny ×1