sebfz1 / wicket-jquery-ui

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

Modifying the behavior of a Wicket Kendo ComboBox for certain events #273

Closed ghost closed 7 years ago

ghost commented 7 years ago

He there. I am using the Wicket Kendo ComboBox. I have to modify its behavior based on certain events as following:

  1. if the user types in the combobox-field the combobox options have to be reloaded dynamically based on what the user is typing
  2. if the user clicks on a specific option which name is ex. like ADVANCED SEARCH a window should open where the user can select an option from another menu. When he selected it and closes the window the combobox should be updated with the value which he selected in the window and not with ADVANCED SEARCH

I've read this instructions. However, its for Kendo UI for jQuery. I tried it out however without success. Maybe I did something wrong. My questions are:

  1. Are those instructions suppose to work also for the Wicket Kendo ComboBox?
  2. If not is it possible to change its behavior via Java and how?
sebfz1 commented 7 years ago

Hi,

  1. The current implementation of the ComboBox is based on a model; it is not as dynamic as the AutoCompleteTextField for instance
  2. There is currently also no "AjaxComboBox", so adding a behavior like the one you describe requires to bind the "change" event.

I think you can achieve what you'd like by using the AutoCompleteTextField. If you really need an AjaxComboBox well... please let me know ! :)

Thanks & best regards, Sebastien.

ghost commented 7 years ago

The strange thing is that if I add an AjaxEventBehavior to the ComboBox it simply ignores it. However, if I add the same AjaxEventBehavior to a normal TextField then it works. So the main problem is that the ComboBox does not allow to overwrite its default AjaxEventBehavior. What I did now was I created a separate TextField which implements the desired AjaxEventBehavior. The idea is now, when the event gets triggered in the TextField then the ComboBox should be refilled with new options.

ghost commented 7 years ago

And hey, thanks for the answer!

sebfz1 commented 7 years ago

Hi,

IMO, the correct way to handles kendo-ui events is to bind the ajaxbehavior callback function to the specified widget event (for instance, see [1])

I've just (quickly) added the AjaxComboBox. I did not tested all cases (for instance when choices are not type of String) but it should give you the opportunity to move forward on your issue.

The snapshot should be available in some minutes (wicket8.x) !

[1] https://github.com/sebfz1/wicket-jquery-ui/blob/wicket8.x/wicket-kendo-ui/src/main/java/com/googlecode/wicket/kendo/ui/form/combobox/ComboBoxBehavior.java#L126

sebfz1 commented 7 years ago

master & wicket6.x snapshots also on their ways...

ghost commented 7 years ago

Cool. Thank you.