我有反应输出:
{{ textOutput("fatalError") }}它生成标记:
<div id="fatalError" class="shiny-text-output shiny-bound-output"></div>我有这样的代码:
.events$fatalError <- list(
errorMessage = "Unknow Error",
index = 0L
)
makeReactiveBinding("fatalError", env = .events)我触发了这样的事件:
fatalError <- function(errorMessage) {
# the error is shown, the class fatal-error indicate that tag should be visible
addClass(selector = "body", class = "fatal-error")
.events$fatalError <- list(
errorMessage = errorMessage,
index = .events$fatalError$index + 1L
)
}但是fatalError输出没有更新,我尝试过这样做(在server.R中):
observeEvent(.events$fatalError, {
# the message is printed to console
print(.events$fatalError$errorMessage)
output$fatalError <- renderText(.events$fatalError$errorMessage)
}, ignoreInit = TRUE)此外,这也是:
output$fatalError <- renderText({
.events$fatalError$errorMessage
})但是标记仍然是空的,当output$fatalError在页面上可见并且具有相同的结果时,我也尝试触发该事件
发布于 2018-02-07 12:27:02
如果发现问题,则在呈现时不能隐藏输出元素,否则它将无法工作(可能是优化的“特性”),而且可能是因为addClass没有等到类在执行下一行之前被添加,所以renderText没有得到可见的输出。
https://stackoverflow.com/questions/48663021
复制相似问题