You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Patrick Petermair <pa...@openforce.com> on 2010/08/27 15:05:24 UTC

autocomplete for AjaxEditableLabel

Hi!

Is there a way to enable autocomplete for AjaxEditableLabel (just like 
AutoCompleteTextField)? I was going through AutoCompleteTextField as a 
reference and wrote my own behavior for autocompletion. The new behavior 
works perfectly for a TextField, but not for AjaxEditableLabel.

Any help? What would be the correct way to do it?

Cheers,
Patrick

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: autocomplete for AjaxEditableLabel

Posted by Patrick Petermair <pa...@openforce.com>.
> Is there a way to enable autocomplete for AjaxEditableLabel (just like 
> AutoCompleteTextField)? I was going through AutoCompleteTextField as a 
> reference and wrote my own behavior for autocompletion. The new behavior 
> works perfectly for a TextField, but not for AjaxEditableLabel.

Answering my own question (in case someone is looking for the same 
functionality through a google search).

AjaxEditableLabel is a panel with a label and textfield component which 
is why adding the autocomplete behavior to it didn't work. I solved it 
by overriding the newEditor() method and adding my behavior to the 
editor in the AjaxEditableLabel panel like so:

AjaxEditableLabel<String> label = new AjaxEditableLabel<String>("foo") {

     @Override
     protected FormComponent<String> newEditor(final MarkupContainer
       parent, final String componentId, final IModel<String> model) {

         final FormComponent form = super.newEditor(parent, componentId,
            model);
         form.add(new MyAutoCompleteBehavior());
         return form;
      }
};

Patrick

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org