dreamRs / toastui

R htmlwidgets for ToastUI libraries: grid, calendar and chart
https://dreamrs.github.io/toastui
Other
83 stars 8 forks source link

cal_proxy_toggle example code not working correctly #43

Open nick-youngblut opened 8 months ago

nick-youngblut commented 8 months ago

The example code for the cal_proxy_toggle function does not work as expected. Specifically, the checkbox selections do not just toggle the clicked boxes, but all calendars are affected (see attached). This seems to be due to:

  observeEvent(input$calendarId, {
    cal_proxy_toggle("cal", input$calendarId, toHide = FALSE)
    cal_proxy_toggle("cal", setdiff(1:3, input$calendarId), toHide = TRUE)
  }, ignoreInit = TRUE, ignoreNULL = FALSE)

in which toHide = FALSE and toHide = TRUE are supposed to toggle the "to show" and "to hide" calendars, respectively, in the list of calendars from the check box group. However, it appears that cal_proxy_toggle() just toggles the calendars, regardless of how the toHide parameter is set.

Screenshot 2024-02-28 at 2 37 22 PM Screenshot 2024-02-28 at 2 37 28 PM Screenshot 2024-02-28 at 2 37 34 PM

sessionInfo

R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.3

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/Los_Angeles
tzcode source: internal

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

other attached packages:
[1] shinyTime_1.0.3    httr2_1.0.0        tidyr_1.3.1        dplyr_1.1.4        shinyBS_0.61.1     toastui_0.3.0.9100
[7] shiny_1.8.0       

loaded via a namespace (and not attached):
 [1] config_0.3.2        rappdirs_0.3.3      sass_0.4.7          utf8_1.2.4          generics_0.1.3      renv_1.0.2         
 [7] digest_0.6.33       magrittr_2.0.3      fastmap_1.1.1       cellranger_1.1.0    jsonlite_1.8.7      googledrive_2.1.1  
[13] promises_1.2.1      httr_1.4.7          purrr_1.0.2         fansi_1.0.6         jquerylib_0.1.4     cli_3.6.1          
[19] rlang_1.1.1         crayon_1.5.2        ellipsis_0.3.2      withr_2.5.0         cachem_1.0.8        yaml_2.3.8         
[25] tools_4.3.1         gargle_1.5.2        memoise_2.0.1       httpuv_1.6.11       curl_5.2.0          vctrs_0.6.5        
[31] R6_2.5.1            mime_0.12           lifecycle_1.0.3     fs_1.6.3            htmlwidgets_1.6.4   fontawesome_0.5.2  
[37] pkgconfig_2.0.3     pillar_1.9.0        bslib_0.5.1         later_1.3.1         glue_1.6.2          Rcpp_1.0.11        
[43] tibble_3.2.1        tidyselect_1.2.0    xtable_1.8-4        htmltools_0.5.7     googlesheets4_1.1.1 shinyWidgets_0.8.1 
[49] phosphoricons_0.2.0 compiler_4.3.1      askpass_1.2.0       openssl_2.1.1      
nick-youngblut commented 8 months ago

It appears that toHide just needed to be flipped:

  observeEvent(input$calendarId, {
    cal_proxy_toggle("cal", input$calendarId, toHide = TRUE)
    cal_proxy_toggle("cal", setdiff(1:3, input$calendarId), toHide = FALSE)
  }, ignoreInit = TRUE, ignoreNULL = FALSE)