闪亮:反应式用户界面

时间:2021-03-23 00:40:24

标签: r shiny

我正在尝试在我闪亮的应用程序中构建一个响应式 UI。我希望如果用户选择“继续”选项,则 UI 中不会出现任何选项,并且如果用户选择“减少”,则 UI 会显示带有我的选项的无线电组。 到目前为止,我知道如何更新无线电组的值,但我不知道如何在没有无线电组“int_dist”的情况下拥有 UI。

      # UI ----------------------------------------------------------

      radioGroupButtons(inputId="radio_group1", 
                        label=tags$i("Social Distance"), 
                        choices=c("Continue" = "cont","Decrease" = "dec")),
      
      radioButtons(
        inputId = "int_dist",
        choices =     c("30%" = "30", "40%" = "40", "50%" = "50"),
        label = "Options"
      ),
      # SERVER ----------------------------------------------------------
    observe({
      option<- input$radio_group1
    
      switch(option,
           "cont" = {
            NO OPTIONS
              
           },
           "dec" = {
               updateRadioButtons(
                   session = session, inputId = "int_dist",
                   choices =     c("30%" = "30", "40%" = "40", "50%" = "50"),
                   label = "Option"                   
                   )
           },
           
    )
})

0 个答案:

没有答案