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

AjaxComboBox callback for every typed character? #367

Closed mdbergmann closed 5 months ago

mdbergmann commented 5 months ago

Hello.

Question on the AjaxComboBox. It allows user input via textfield and submitting this works OK.

But we'd like to use it to filter elements as the user types. For that the ComboBox must submit every typed character. I'm not sure if this is a use-case that this AjaxComboBox actually supports. We've tried attaching a AjaxFormComponentUpdatingBehavior for "input" events but it doesn't seem to send anything to the server. Can it be that this interferes with the already attached Ajax functionality?

sebfz1 commented 5 months ago

Hi Manfred,

IIRC, there's an option to pass to indicate how many chars you want the user to fill before it triggers. Look at this option, set it to 1 and you should be good.

Message ID: @.***>

mdbergmann commented 5 months ago

OK, thanks for info. Looks like you mean the minLength attribute of the Kendo component. But how is the input(?) event transported to the server? Should it work via AjaxFormComponentUpdatingBehavior? Or is it something built-in, like the onAjax of the `KendoUIBehavior?

sebfz1 commented 5 months ago

Yes, minLength sounds about right. Pass it as Options and the ajax should trigger automatically. You do not have to add a custom AjaxFormComponentUpdatingBehavior, IIRC

mdbergmann commented 5 months ago

Alright. But what to override/implement? AjaxComboBox only has onSelectionChanged to override. You mean this? I'd assume it should be something that also just ComboBox can do, but it doesn't have onSelectionChanged. Sorry to bother if I miss something obvious.

mdbergmann commented 5 months ago

Maybe I'm on the wrong path here. I am/was assuming that there is a callback for every typed character so that a new filtered list of choices can be returned to the component. But now I think that's not the case. I've seen on can set a 'filter' function on the Kendo component. So I suppose that could be utilized to filter the choices.

mdbergmann commented 5 months ago

Yep, filter function works when set to something like contains. Thanks for your help. I'll close this.

mdbergmann commented 5 months ago

Ah, sorry. Back to it.

So the functionality we need is that every typed character should be sent to server to update the model of the ComboBox by generating new model based on the input. So it's more like an auto-complete functionality. Is this supported?

mdbergmann commented 5 months ago

Again, sorry for bother. Looking more closely I think ComboBox doesn't support this (out-of-the-box) because the 'change' event setup is used for the drop-down selection. We're using AutoCompleteTextField now. It does what we need.