Replies: 1 comment
-
Sounds worth pursuing. I think I see where you're going and I think it make sense. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Here's an idea i had to lighten server load for the "Observations needing Identification" filters, but it may be applicable elsewhere.
Currently, our autocomplete fields send AJAX requests, and the controller handling them tries to match the user's string against a db column (like
observations.text_name
), then the controller returns an array of matching strings from the column.If the user accepts a string match and submits the form, the form will send that string as a param, and the controller response has to look up the string again to try to match it to a model instance.
What if the form could send the model ID instead of the string, as the
param
?I'm thinking to write a second type of AJAX response that instead of an array of strings, returns a JSON object, keyed by the db ID, instead. That way, the UX could be a "autocompleted
select
" that sends the ID as the value selected, avoiding the second lookup. The user's choices would be truly constrained by available options, which in the case of searches is sometimes what we want.The AJAX response would send an object like this to populate the
select
options in the dropdown:Here's the UI pattern, that i imagine we've all used elsewhere on the web.
Beta Was this translation helpful? Give feedback.
All reactions