Re: Help with pattern for reusable large chooser / select

Kyle Maxwell
Wed, 31 Aug 2005 18:20:05 -0000

I think that the primary pattern 95% of us use for this type of
situation is text_field_with_auto_complete, so I wouldn''t worry to
much about making it available for global use.

Anyhow, in the popup:
1. Start from a standard scaffold-style paginated list.
2. Add :conditions => ["user LIKE ?",
"%#{@params[:search]}%"]
3. Add a search form:
<input name=search value="<%=h
@params[:search]%>">
4. Add a link to each row with
javascript:opener.formElement.value=<%=row.value%>;window.close()

Kyle Maxwell

On 8/31/05, J T <future429-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
> I have an invoice application that requires the user to select a user
object
> named "creator" from a list of over 100k users. Since there are
so many users a
> traditional select box with 100k options is out of the question. An AJAX
enabled
> select box is out of the question too due to the types of clients that will
use
> this application. I think it should work something like this...
>
> -User creates invoice and fills out some fields (e.g. description)
> -User clicks "select creator" link that takes them to a user
select page
> -On the user select page they can type in a partial name, click submit, and
the
> matches are returned. When they find the one they want they click a
"select
> user" link. This link returns them to the invoice page, populates the
"creator"
> field and keeps all of their previous edits (e.g. description).
>
> Ideally I would like to construct this "choose user"
functionality so that it
> could be reused for other applications (e.g. purchase order has a
"creator"
> field as well).
>
> Any thoughts on how to pattern this?
>
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>