From 221b84eb6a83f3bb80b21cf28ead41539aff4ad9 Mon Sep 17 00:00:00 2001 From: Dean Attali Date: Thu, 12 Sep 2019 15:19:26 -0400 Subject: [PATCH] fix #82 - setSelection didn't trigger the shiny selected input --- DESCRIPTION | 2 +- NEWS.md | 3 ++- inst/htmlwidgets/timevis.js | 6 ++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 6c8ea5c..95ab94c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: timevis Title: Create Interactive Timeline Visualizations in R -Version: 0.5.0.9003 +Version: 0.5.0.9004 Authors@R: c( person("Dean", "Attali", email = "daattali@gmail.com", role = c("aut", "cre"), comment = "R interface"), diff --git a/NEWS.md b/NEWS.md index 4a7e867..d361a99 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,9 +1,10 @@ # timevis 0.5.* -TODO +TODO date - Add `timezone` parameter to `timevis()` - supports showing the timeline in a different timezone than your local machine (#67) - Add `setCustomTime()` and `setCurrentTime()` functions (#20) +- Fixed bug: using `setSelection()` did not trigger the Shiny selected input (#82) - Add documentation about how to add custom style to timevis (#45) - Add documentation tab to the demo app diff --git a/inst/htmlwidgets/timevis.js b/inst/htmlwidgets/timevis.js index b3635a4..f0cda7d 100644 --- a/inst/htmlwidgets/timevis.js +++ b/inst/htmlwidgets/timevis.js @@ -233,6 +233,12 @@ HTMLWidgets.widget({ }, setSelection : function(params) { timeline.setSelection(params.itemId, params.options); + if (HTMLWidgets.shinyMode) { + Shiny.onInputChange( + elementId + "_selected", + params.itemId + ); + } }, setWindow : function(params) { timeline.setWindow(params.start, params.end, params.options);