Html 当下拉按钮打开时,如何停止计算闪亮的应用程序?

Html 当下拉按钮打开时,如何停止计算闪亮的应用程序?,html,css,r,shiny,dropdown,Html,Css,R,Shiny,Dropdown,我正在开发一个闪亮的应用程序来过滤数据库(比如Excel),我想在下拉按钮打开时停止应用程序的所有计算。你知道我怎么做吗?这是我的第一个闪亮的应用程序,所以我很确定我犯了一些愚蠢的错误 在我的下拉按钮中,我有一个CheckBoxGroupInput,为数据库的一个变量提供了不同的选择。问题:我必须在复选框GroupInput中的每个选择之间等待几秒钟,因为应用程序正在刷新复选框中的每个附加选择 一个变量的示例: ui: dropdownButton( label

我正在开发一个闪亮的应用程序来过滤数据库(比如Excel),我想在下拉按钮打开时停止应用程序的所有计算。你知道我怎么做吗?这是我的第一个闪亮的应用程序,所以我很确定我犯了一些愚蠢的错误

在我的下拉按钮中,我有一个CheckBoxGroupInput,为数据库的一个变量提供了不同的选择。问题:我必须在复选框GroupInput中的每个选择之间等待几秒钟,因为应用程序正在刷新复选框中的每个附加选择

一个变量的示例:

ui:

dropdownButton(
                 label = "Country :", status = "default", width = 200, circle = FALSE,
                 actionButton(inputId = "country_all", label = "(Un)select all"),
                 uiOutput("countrybis")
               ),
               verbatimTextOutput(outputId = "country_print")
服务器:

dropdownButton(
                 label = "Country :", status = "default", width = 200, circle = FALSE,
                 actionButton(inputId = "country_all", label = "(Un)select all"),
                 uiOutput("countrybis")
               ),
               verbatimTextOutput(outputId = "country_print")
用于刷新不同复选框中的每个列表的函数:

output$countrybis <- renderUI({
observeEvent(input$Country_DropDown,{
  print("bla")
  Country_List <- Function_List_Data(p_type = "COUNTRY",
                       p_processchoice = input$dataprocess_choice,
                       p_year = input$year,
                       p_variable = input$variable_list,
                       p_product = input$product_list,
                       p_country = NULL,
                       p_item = input$item_list,
                       p_season = input$season_list,
                       p_region = input$region,
                       p_calcamp = input$campaign_calendar)
})
checkboxGroupInput(inputId = "country_list", label = "Choose", choices = sort(Country_List), selected = input$country_list) })

Function\u List\u数据如果你有办法知道下拉列表是打开的还是关闭的(让我们想象一下,作为一个函数
dropdown\u是打开的
),那么你可以在反应开始时使用
验证(需要(!dropdown\u是打开的(),“等待下拉”)
,以防止在下拉列表关闭之前进行评估。请参见验证。只有半个答案,所以我将把它作为一个评论:)你好,安托万,谢谢你的回答。我试过这样的方法:我使用了ObserveEvent或“onclick”(shinyjs包):我不知道列表何时打开,但我知道何时单击下拉按钮。因此,当我单击下拉按钮时,我运行函数来生成列表,但它不起作用(向量强制执行某些内容…)。我将在明天早上发送我的代码给你看。我编辑了我的第一篇文章,向你展示了我是如何更改代码的。很抱歉,我们误解了自己:事实上我没有解决我的问题的方法,似乎R在生成复选框后生成了国家/地区列表,而“ObserveeEvent”在创建复选框之前写入。你有什么想法吗?对不起,我被另一个帖子弄糊涂了,海报实际上找到了答案--“如果你有办法知道下拉列表是打开的还是关闭的(让我们想象一下,作为一个函数,
dropdown\u is\u open
),那么你可以使用
验证(需要(!dropdown\u is\u open(),“Waiting for dropdown”))
在您的反应开始时,以防止评估,直到下拉列表关闭。请参见验证。只有半个答案,所以我将把它作为一个评论:)你好,安托万,谢谢你的回答。我试过这样的方法:我使用了ObserveEvent或“onclick”(shinyjs包):我不知道列表何时打开,但我知道何时单击下拉按钮。因此,当我单击下拉按钮时,我运行函数来生成列表,但它不起作用(向量强制执行某些内容…)。我将在明天早上发送我的代码给你看。我编辑了我的第一篇文章,向你展示了我是如何更改代码的。很抱歉,我们误解了自己:事实上我没有解决我的问题的方法,似乎R在生成复选框后生成了国家/地区列表,而“ObserveeEvent”在创建复选框之前写入。你有什么想法吗?对不起,我被另一个帖子弄糊涂了,海报上实际上找到了一个答案--”
observeEvent(input$country_all, {
Country_List <- Function_List_Data(p_type = "COUNTRY",
                     p_processchoice = input$dataprocess_choice,
                     p_year = input$year,
                     p_variable = input$variable_list,
                     p_product = input$product_list,
                     p_country = NULL,
                     p_item = input$item_list,
                     p_season = input$season_list,
                     p_region = input$region,
                     p_calcamp = input$campaign_calendar)
if (is.null(input$country_list)) {
  updateCheckboxGroupInput(session = session, inputId = "country_list", selected = Country_List)}
else {updateCheckboxGroupInput(session = session, inputId = "country_list", selected = "")}})
output$country_print <- renderPrint({
if(is.null(input$country_list)){"- ALL -"}
else{as.matrix(input$country_list)}})
output$countrybis <- renderUI({
observeEvent(input$Country_DropDown,{
  print("bla")
  Country_List <- Function_List_Data(p_type = "COUNTRY",
                       p_processchoice = input$dataprocess_choice,
                       p_year = input$year,
                       p_variable = input$variable_list,
                       p_product = input$product_list,
                       p_country = NULL,
                       p_item = input$item_list,
                       p_season = input$season_list,
                       p_region = input$region,
                       p_calcamp = input$campaign_calendar)
})
checkboxGroupInput(inputId = "country_list", label = "Choose", choices = sort(Country_List), selected = input$country_list) })