简体   繁体   中英

Enable/disable not working with flexdashboard+shinyjs

I am aware of this issue and it apparently having being solved, but I've double checked I've got the latest versions of the relevant packages and neither disable nor disabled seem to be working.

Minimal example:

---
title: "test"
runtime: shiny
output: 
  flexdashboard::flex_dashboard

---

```{r global, include=FALSE}

library(shiny)
library(shinyjs)
library(flexdashboard)
```

```{r}
print(sessionInfo())

disabled(checkboxGroupInput("a", label = "heck", choices = 1:3))
disable(id = "a")
```

Session info:

R version 3.6.0 (2019-04-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252 
[2] LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] flexdashboard_0.5.1.1 shinyjs_1.0           shiny_1.3.2          

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.2      digest_0.6.21   later_0.8.0     mime_0.7       
 [5] R6_2.4.0        jsonlite_1.6    xtable_1.8-4    magrittr_1.5   
 [9] evaluate_0.14   stringi_1.4.3   promises_1.0.1  rmarkdown_1.15 
[13] tools_3.6.0     stringr_1.4.0   httpuv_1.5.2    xfun_0.9       
[17] yaml_2.2.0      compiler_3.6.0  htmltools_0.3.6 knitr_1.25     

Someone posted and deleted comment saying I needed to use shinyjs::useShinyjs() which was pretty much correct, though to be precise, it needs to be useShinyjs(rmd = TRUE) . If OP sees this, feel free to post as an answer so you can get proper credit.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM