sebfz1 / wicket-jquery-ui

jQuery UI & Kendo UI integration in Wicket
http://www.7thweb.net/wicket-jquery-ui/
Other
92 stars 58 forks source link

Need enhancement for the autocomplete component #10

Closed clempinch closed 12 years ago

clempinch commented 12 years ago

Hello, I am using the AutoCompleteTextField component, but I would like the component to start the getChoices() method after a certain number of characters entered in the text field (because I would like to avoid calls retrieving long list from the database). I guess it should be an enhancement on your side. Is it possible to have it?

sebfz1 commented 12 years ago

Hello,

Yes, I just forgot the definition of onConfigure(JQueryBehavior behavior), which allows to set the widget options. I will add it shorty.

Thanks and best regards, Sebastien.

sebfz1 commented 12 years ago

Hi,

I added the method mentioned above, the usage to specify the minimum string-length before querying the server is:

form.add(new AutoCompleteTextField<String>("autocomplete", new Model<String>()) {

    private static final long serialVersionUID = 1L;

    @Override
    protected void onConfigure(JQueryBehavior behavior)
    {
        super.onConfigure(behavior);

        behavior.setOption("minLength", 3);
    }
}

Please note that, by providing this method, you are also able to define the delay the widget waits before querying the server (option delay). As this overlaps with the AjaxCallThrottlingDecorator (previously sets to one second), I removed it, and let the default widget delay (300ms). I will publish a note in the next release/changelog about this.

Thanks & best regards, Sebastien.

clempinch commented 12 years ago

Thanks a lot. Seems simple to use :-) I will test it at the next release. Regards,

Clement