You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Peter Ertl (JIRA)" <ji...@apache.org> on 2007/12/15 11:42:43 UTC

[jira] Commented: (WICKET-488) Allow more complex behaviour for AutoCompleter component

    [ https://issues.apache.org/jira/browse/WICKET-488?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12552046 ] 

Peter Ertl commented on WICKET-488:
-----------------------------------

I uploaded a patch implementing this improvement like Igor suggested (-- WICKET488_MoreComplexBehaviorForAutocompleter.patch)

There's a new method

  CharSequence AbstractAutoCompleteRenderer#getOnSelectJavascript(Object item)

that returns custom javascript for each rendered item.

It will be executed upon selecting it in the autocompleter by either hitting enter or clicking on it.

> Allow more complex behaviour for AutoCompleter component
> --------------------------------------------------------
>
>                 Key: WICKET-488
>                 URL: https://issues.apache.org/jira/browse/WICKET-488
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-extensions
>         Environment: wicket-1.x snapshot
>            Reporter: Peter Ertl
>             Fix For: 1.3.0-rc3
>
>         Attachments: autocomplete-on-select-including-onclick.patch, autocomplete-on-select.patch, jquery.js, WICKET488_MoreComplexBehaviorForAutocompleter.patch
>
>
> It would be nice to be able to modify the default behaviour of the ajax autocompleter component upon selection of an list item. this would make it a even more useful component and exceed it's capabilities beyond simple text replacement.
> current behaviour:
> ### snip : wicket-autocomplete.js line 93-97 ###
>   case KEY_ENTER:
>     if(selected>-1){
>       obj.value=getSelectedValue();
>       hideAutoComplete();
>       hidingAutocomplete=1;
> ### eof snip ###
> Instead of having obj.value= being filled by the current text value it would be nice to have the option of specifying a js function callback to e.g. post back the selected value to the server. This way you could implement more complex behaviour, for example select a company address from a list and, on selecting it, send back the address id to the server which then would fill out street, house number, zip code and city.
> pseudo code:
>   if selected
>       if callback
>         callback(value)
>       else
>         obj.value = current value   
>       end
>     .....
> probably the right place for such a on-select contribution would be the autocomplete renderer.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.