相关疑难解决方法(0)

Shiny:如何使用actionButton初始化空的reactiveValues?

背景:在我的应用程序中,我构建了一个弹出模式,其中用户可以定义变量/参数,然后在按下时将它们存储在 areactiveValues()actionButton。这看起来效果很好。

在此输入图像描述

问题:我有一个单独的actionButton,应该清除/清空保存reactiveValues上面输入的内容。不幸的是,这似乎不起作用——也就是说,按下按钮没有任何作用。

最小可重复代码:

library(DT)

# UI modules
sidebarCharts <- function(id) {
  ns <- NS(id)
  tagList(
    p(),
    actionButton(ns("settings"), "Settings", 
                icon = icon("cogs"), 
                width = '100%',
                class = "btn btn-info"),
    p(),
    actionButton(ns("refreshMainChart") ,"Refresh", 
                 icon("refresh"),
                 width = '100%',
                 class = "btn btn-primary"),
    p(),
    textOutput(ns("info"))  # FOR DEBUGGING
  )
}

mainChartUI <- function(id) {
  ns <- NS(id)
  plotOutput(ns("mainChart"), width = "100%")
}

# UI module for the 2 buttons in the modal:
modalFooterUI …
Run Code Online (Sandbox Code Playgroud)

r shiny shinydashboard shinyjs shiny-reactivity

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

标签 统计

r ×1

shiny ×1

shiny-reactivity ×1

shinydashboard ×1

shinyjs ×1