ramnathv / htmlwidgets

HTML Widgets for R
http://htmlwidgets.org
Other
792 stars 205 forks source link

Widget initialization fails when hidden in RMarkdown #392

Open paulklemm opened 4 years ago

paulklemm commented 4 years ago

Potentially related to https://github.com/rstudio/DT/issues/204, https://github.com/timelyportfolio/parcoords/issues/40.

DT and parcoords widgets do not render when they are located in either

  1. a hidden {.tabset} or
  2. within <details></details>.

Minimal Example

sessionInfo() output ``` R version 4.0.3 (2020-10-10) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04.1 LTS Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0 LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0 locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 [4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C [10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices datasets utils methods base other attached packages: [1] parcoords_1.0.0 DT_0.16 magrittr_1.5 loaded via a namespace (and not attached): [1] Rcpp_1.0.5 rstudioapi_0.11 servr_0.20 [4] knitr_1.30 xtable_1.8-4 R6_2.4.1 [7] rlang_0.4.8 fastmap_1.0.1 stringr_1.4.0 [10] tools_4.0.3 xfun_0.18 xaringan_0.18 [13] htmltools_0.5.0 crosstalk_1.1.0.1 yaml_2.2.1 [16] digest_0.6.26 shiny_1.5.0 BiocManager_1.30.10 [19] later_1.1.0.1 htmlwidgets_1.5.2.9000 promises_1.1.1 [22] evaluate_0.14 mime_0.9 rmarkdown_2.4 [25] stringi_1.5.3 compiler_4.0.3 jsonlite_1.7.1 [28] httpuv_1.5.4 renv_0.12.0 ```
---
title: "Parcoords and Crosstalk"
output: html_document
---

# {.tabset}

## First Tab

## Second tab

```{r main}
shared_iris <- crosstalk::SharedData$new(iris)
parcoords::parcoords(shared_iris)
DT::datatable(shared_iris)


When clicking on **Second tab**:

<img width="944" alt="image" src="https://user-images.githubusercontent.com/2169489/98652184-8a951200-233b-11eb-8946-3b4c459a36f9.png">

Upon resizing the window:

<img width="931" alt="image" src="https://user-images.githubusercontent.com/2169489/98652219-98e32e00-233b-11eb-91e3-d31ecc87aca0.png">