Question

I am trying to filter a list that is placed into a listview through the use of 2 drop down boxes.

The first dropdown box is titled price and the second is owner.

I want to be able to select a value in one or more of these drop down boxes and then have the List view re-render with the filtered results.

The trouble is I do not know how to begin this task, would someone be so kind as to enlighten me :D

Thanks in advance!

Was it helpful?

Solution

Your best starting point is probably this example: (Source code also available on this page, ChoicePage.java is the name)

First of all, you have to use a dynamic model in your ListView that generates the list of items depending on what you had selected in the dropdown boxes.

Then the basic idea is that you add an AjaxFormComponentUpdatingBehavior to the components that control the updates (your two dropdown boxes in your case), and in the onUpdate() method of this behaviour you should add the component you want to update to that AjaxRequestTarget passed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top