Re: Using the Autocompleter

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using the Autocompleter

Andy Pahne


Found the solution:

Use the Suggest component instead.
http://tapestry.apache.org/tapestry4.1/components/scriptaculous/suggest.html

The Autocompleter has issues anyway:
http://issues.apache.org/jira/browse/TAPESTRY-1244






Andy Pahne schrieb:

>
> I am trying to implement a form that uses the Autocompleter component
>   http://tapestry.apache.org/tapestry4.1/components/dojo/autocompleter.html
>
>
> I had a look at the TimeTracker demo application. It already works, but
> I have one requirement that's differnet from the way the demo is
> implemented:
>
> The time trackler loads a complete list of objects from the DAO layer:
>
>     return new DefaultAutocompleteModel(getProjectDao().list(), "id",
> "name");
>
>
> In my application it is not possible to load the complete list from the
> database. Instead the function in my DAO layer takes one argument:
>
>    List<Location> getManager().getLocations(String startWith);
>
>
> So, how can I retrieve the user's input in the autocompleter field? For
> example: the user enters "Aber", I retireve all Locations from the
> database that start with "Aber" (Aberdeen), and then build a model.
>
> I tried
>
>     @EventListener(
>         events = "onValueChanged",
>         targets = "locationChoose"
>     )
>     public void projectSelected(BrowserEvent event){
>
>         String selection = event.getMethodArguments().getString(0);
>         LOG.trace("Selected value = '" + selection + "'");
>
>
>         getBuilder().updateComponent("locationDescription");
>     }
>
> but that return an identifier. The problem is: I don't need an
> identifier for my call into the DAO layer, but the raw user's input...
>
>
> Another question: I want my autocompleter to start async request only
> when the user entered three or more chars. Is that possible?
>
> Andy
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


--
Andy Pahne
System Architektur & Software Design

net22 GmbH
Ehrenbergweg 24
32760 Detmold

http://www.net22.de

Email     [hidden email]
Telefon   +49 (5231) 58 06 40
Mobil     +49 (174) 171 68 70

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...