Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wicket, how to lazy-load DropDown choices on click?

I have a lot of DropDownChoice components with many items in a form, and on loading the form, I'd like to display only the saved selected options. When the user clicks on a DropDownChoice, I'd like to ajax-load the full item list on the fly.

Can this be done?

like image 802
Per Avatar asked Nov 05 '22 02:11

Per


1 Answers

Add a OnChangeAjaxBehavior to your dropdown-component. Override the onUpdate-method and add another component to the target. The chosen value of the dropdown-component is inside its model.

Update: Okey, I think I know what you're trying to achieve. Add an AjaxFormComponentUpdatingBehavior to your dropdown component with "onclick" as constructor parameter. Override the onUpdate-method and add your dropdown component to the target. Before you do that, update the dropdown model, so that it now contains all values.

like image 93
rotsch Avatar answered Nov 10 '22 19:11

rotsch