我有两个闪亮的模块,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)