hansenjohnson/WhaleMap

Feature request: multiple 'Go' buttons to initiate map update

Closed this issue · 2 comments

Having multiple 'Go' buttons in various places (e.g., top and bottom of the data tab in the editor pane) would be very convenient, especially for users with small displays. I attempted this locally in by simply copying and pasting the ui for the Go button in ui.R, but only the first copy works. I suspect there is a simple way of doing this, but I don't know...

You can't have multiple HTML tags with the same ID -- an HTML limitation, not shiny. I suspect the solution is to bind an 'onclick' js function to the second button, which then pushes the 'real' button, somewhat similar to the 'enter to submit' js function from commit c250a84

There's some related stuff here:
http://www.open-meta.org/technology/one-observer-for-all-buttons-in-shiny-using-javascriptjquery/
which I found from here:
https://stackoverflow.com/questions/39707097/multiple-action-buttons-with-one-event-handler-in-shiny/39719396

An alternative solution is to have a floating Go button that's anchored in the corner of the page. I've implemented that on the dev branch (a8e9032), and will test out on different browsers / devices before merging to master.