You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ben Hutchison <be...@ibsglobalweb.com> on 2010/03/15 02:42:34 UTC
Looking for a less chatty auto-complete component?
Hi all,
We're developing a wicket web-application that makes heavy use of
auto-complete text fields populated from slow back-end (mainframe) web
services.
Concerned that standard auto-complete behavior will be too chatty and
result in many calls to slow services, we're keen on an alternative less
chatty model:
- No autocomplete behavior is triggered until at least N (eg 3)
characters have been entered.
- When N characters are entered, a query is performed, once.
- These results are cached client-side, and subsequent character entry
simply narrows the search in the pre-retrieved results.
- If any of the first N characters in the string are altered, the cache
results are discarded and a new query is performed.
Does anything like this exist in open source that could be reused?
-Ben
--
*Ben Hutchison
Senior Developer
* Level 2 476 St Kilda Road Melbourne VIC 3004
T 613 8807 5252 | F 613 8807 5203 | M 0423 879 534 |
www.ibsglobalweb.com <http://www.ibsglobalweb.com/>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Looking for a less chatty auto-complete component?
Posted by Thomas Kappler <th...@isb-sib.ch>.
On 03/15/10 02:42, Ben Hutchison wrote:
> Hi all,
>
> We're developing a wicket web-application that makes heavy use of
> auto-complete text fields populated from slow back-end (mainframe) web
> services.
>
> Concerned that standard auto-complete behavior will be too chatty and
> result in many calls to slow services, we're keen on an alternative less
> chatty model:
>
> - No autocomplete behavior is triggered until at least N (eg 3)
> characters have been entered.
> - When N characters are entered, a query is performed, once.
> - These results are cached client-side, and subsequent character entry
> simply narrows the search in the pre-retrieved results.
> - If any of the first N characters in the string are altered, the cache
> results are discarded and a new query is performed.
All this should be doable with reasonable effort by overriding
AutoCompleteTextField's getChoices(). I've never stored things
client-side, but I'm sure you can find how to do that in the archives or
the wiki. Apart from that, you would do something like that:
String prevInput;
List<String> suggestions;
@Override
protected Iterator<String> getChoices(String input)
{
if (!suggestions.isEmpty() && firstNEqual(input, prevInput)
// narrow down existing suggestions
else if (input.length() >= MIN_INPUT_LENGTH)
// backend service query, filling suggestions
else
return Collections.<String>emptyList().iterator();
}
--
-------------------------------------------------------------------
Thomas Kappler thomas.kappler@isb-sib.ch
Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
CMU, rue Michel Servet 1
1211 Geneve 4
Switzerland http://www.uniprot.org
-------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Looking for a less chatty auto-complete component?
Posted by Peter Thomas <pt...@gmail.com>.
On Mon, Mar 15, 2010 at 7:12 AM, Ben Hutchison <be...@ibsglobalweb.com> wrote:
> Hi all,
>
> We're developing a wicket web-application that makes heavy use of
> auto-complete text fields populated from slow back-end (mainframe) web
> services.
>
> Concerned that standard auto-complete behavior will be too chatty and result
> in many calls to slow services, we're keen on an alternative less chatty
> model:
>
> - No autocomplete behavior is triggered until at least N (eg 3) characters
> have been entered.
> - When N characters are entered, a query is performed, once.
> - These results are cached client-side, and subsequent character entry
> simply narrows the search in the pre-retrieved results.
> - If any of the first N characters in the string are altered, the cache
> results are discarded and a new query is performed.
>
> Does anything like this exist in open source that could be reused?
>
> -Ben
>
You could use this blog post as a starting point, the YUI autocomplete
component allows for a lot of customization on the client side like
you need:
http://ptrthomas.wordpress.com/2009/08/12/wicket-tutorial-yui-autocomplete-using-json-and-ajax/
> --
>
>
>
> *Ben Hutchison
> Senior Developer
> * Level 2 476 St Kilda Road Melbourne VIC 3004
> T 613 8807 5252 | F 613 8807 5203 | M 0423 879 534 | www.ibsglobalweb.com
> <http://www.ibsglobalweb.com/>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org