Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

htmlwidgets for shiny inputs #203

Open
RicLouRiv opened this issue Apr 19, 2016 · 7 comments
Open

htmlwidgets for shiny inputs #203

RicLouRiv opened this issue Apr 19, 2016 · 7 comments

Comments

@RicLouRiv
Copy link

@RicLouRiv RicLouRiv commented Apr 19, 2016

Hello,

Could someone point me to an example of how to use htmlwidgets to create Shiny inputs? For example, I'd like to create a slider widget based on limitslider (https://github.com/vanderlee/limitslider).

Many thanks!

@timelyportfolio
Copy link
Collaborator

@timelyportfolio timelyportfolio commented Apr 19, 2016

@RicLouRiv, limitslider is very neat. Unfortunately, we have not fully settled on an API to make htmlwidgets act as Shiny inputs. However, in #86, you can see a very long discussion of this particularly starting here. There is some additional early discussion in #19.

@jcheng5
Copy link
Collaborator

@jcheng5 jcheng5 commented Apr 19, 2016

I'd check this out: http://shiny.rstudio.com/articles/building-inputs.html

If we decide to expand htmlwidgets to include inputs as well, it's very likely that it'll be an easy transition from a Shiny input to an htmlwidget input, as was the case for Shiny outputs to htmlwidget outputs.

@RicLouRiv
Copy link
Author

@RicLouRiv RicLouRiv commented Apr 20, 2016

Thank you both very much for your quick reply!

@jrowen
Copy link

@jrowen jrowen commented Aug 10, 2016

I'd also express support for adding input functionality to htmlwidgets. In rhandsontable, we've bound a few change events to shiny inputs, which provides a little shiny input/output functionality. Because the input isn't bound until the table changes, it can be a bit challenging to set-up shiny apps that rely on the initial widget data for calculations.

@jrowen
Copy link

@jrowen jrowen commented Aug 10, 2016

It would also be useful to be able to leverage shiny's registerInputHandler functionality to run custom methods that automatically convert the widget data to a data.frame.

@petegordon
Copy link

@petegordon petegordon commented Jun 22, 2018

For anyone else that lands here, trying to learn the way to add Shiny Inputs to htmlwidgets (and how to do the JavaScript binding for interactions). @aarizvi pointed me to this blog post (section 7) and it answered my question perfectly (just add observeEvent in Shiny server, after wiring up Shiny.onInputChange() in the javascript). Good stuff!

https://deanattali.com/blog/htmlwidgets-tips/#widget-to-r-data

@krlmlr
Copy link

@krlmlr krlmlr commented Apr 11, 2019

@RicLouRiv: Did you succeed in wrapping the limitslider in Shiny?

I have also found @JohnCoene's tutorial very useful: https://john-coene.com/post/how-to-build-htmlwidgets/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants