Frage

Let's say I had the pagelistview on which there are some links, such as animals, birds, and trees, as well as a drop down, which has some values like 'Run', 'Fly' and 'Fruit'.

The expected behavior is that when the user clicks an "animal" the dropdown shows "Run" and if the user wants to change the drop down selection, he can click on the drop down, so all the 3 items (i.e. 'Run', 'Fly', 'Fruit') are accessible.

How can this be achieved?

War es hilfreich?

Lösung

Set the modelObject of the action dropdown ('Run', 'Fly', 'Fruit') when you click on your link (animals, birds, and trees,).

add(new AjaxLink("run"){                                                                                                                                                                                                                                                                                                  
       private static final long serialVersionUID = 1L;                                                                                                       

       @Override                                                                                                                                              
       public void onClick(AjaxRequestTarget target) 
       {                                                                                                        
            actionDropdown.setModelObject("Run");          
            target.addComponent(actionDropdown);         
       }                                                                                                                                                      
});

This should change whats selected in the action dropdown but also leave the other options available to be selected.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top