Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
renderText don';我不能在光亮的地方工作_R_Shiny - Fatal编程技术网

renderText don';我不能在光亮的地方工作

renderText don';我不能在光亮的地方工作,r,shiny,R,Shiny,我有无功输出: {{ textOutput("fatalError") }} 它生成标签: <div id="fatalError" class="shiny-text-output shiny-bound-output"></div> 我有这样的代码: .events$fatalError <- list( errorMessage = "Unknow Error", index = 0L ) makeReactiveBinding("fata

我有无功输出:

{{ 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
  )
}

.events$fatalError发现问题,渲染时不能隐藏输出元素,否则它将无法工作(这可能是优化“功能”),可能是因为addClass在执行下一行之前不等待添加该类,因此renderText的输出不可见

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
})