daattali / shinyjs

💡 Easily improve the user experience of your Shiny apps in seconds
https://deanattali.com/shinyjs
Other
728 stars 119 forks source link

Extend reset to shinyWidgets inputs #255

Open ApexHeel opened 1 year ago

ApexHeel commented 1 year ago

The reset functionality of shinyjs is great. However, it doesn't work with shinyWidgets inputs (e.g., autonumericInput).

shinyWidgets: https://github.com/dreamRs/shinyWidgets https://dreamrs.github.io/shinyWidgets/index.html

daattali commented 1 year ago

I don't know enough about hte internals of shinyWidgets, but if one of their authors (or anyone else) would like to take the initiative to submit a PR for this I'd be very happy to help make it happen! Ensuring that hide/show/enable/disable work would be the first priority for any input they want to bring over to shinyjs, and reset can be the next thing to work on.

ApexHeel commented 1 year ago

I did some digging via developer tools and adding other shinyWidgets UI options. Their version of the dropdown box called "picker" does work out of the box with shinyJS reset as a data-shinyjs-resettable-type = "Select".

The other (first) input that I was using that does not get reset is their version of a numeric input ("autonumericInput"). It gets picked up by shinyJS too but as data-shinyjs-resettable-type = "Text" instead of "Numeric". In shinyWidgets autonumericInput is specified by "value".