Closed sckott closed 8 years ago
By input box do you mean the text area where people enter species?
Unfortunately you can't trigger with enter because textarea is multi-line. If it was an input text then enter would work. So we do need a button here.
On Saturday, June 8, 2013 at 11:52 AM, Scott Chamberlain wrote:
This is with respect only to having a submit button in the app, which I will likely add. Would be nice if hitting enter in the input box activated the submit button instead of starting a new line. Thoughts anyone? @ropensci/owners
— Reply to this email directly or view it on GitHub (https://github.com/ropensci/usgs_app/issues/15).
Yes, that's the one. Yeah, I think we have to have the submit button because, for example, the interactive map will update on every key stroke in the text area for entering species, instead when you are done typing...
The select2.js solution would avoid the need for a submit button. But it would suffer from the issue of the change not being communicated back to R. Maybe it is possible to silently trigger a click in the background as users add more species to the list, so that the map updates.
Ramnath, Yes, looking forward to select.js being able to send changes to R.
There are some new features with Shiny v0.6.0 - perhaps there is something in there to help us
Just going with submit button for now
The current implementation requires the submit button to be pressed even when just updating the color or map provider. Can you isolate the effect of the submit button so that it is required only to retrieve data from the API. I haven't seen your implementation, but I believe that isolating the submit button's effect to the data function would do the trick.
Good point. Yes, I will try to isolate the Submit button's action.
Hmmm, does isolate()
work with only the actionButton
? Or with Submit Button as well?
I think I see the issue now. The submit button in that tab prevents any actions from occurring till it is hit. I am trying to figure out how we can modify the code so that when the submit button is pressed after a user chooses a different map provider, the app doesnt connect to the API to fetch the data all over again.
Perhaps we can isolate the changes to the map styling only (color palette, map layer) so that those don't trigger API calls - all other changes in the sidebar need to call APIs again (taxon names, number of occurrences, number of papers).
Good point.
I will try isolating the map styling then to not trigger API calls. I am also adding download buttons on each tab...
You might want to see if actionButton works better, since you can control things better. An ugly hack would work as follows.
<input id = 'actionbtnstate' type='text' style='display:none;'>
to your UI, and initialize to 0
This is with respect only to having a submit button in the app, which I will likely add. Would be nice if hitting enter in the input box activated the submit button instead of starting a new line. Thoughts anyone? @ropensci/owners