here is how to build what you are looking for.
class MyPage extends WebPage {
private String criteria;
//getter/setter for criteria
public MyPage() {
IModel listModel=new LoadableDetachableModel() {
Object load() {
UserService service=...get user service;
List users=service.findUsersFiltered(criteria);
return users;
}
}
add(new ListView("users", listModel) {....});
// so here we have the listview that will show a list that is filtered on page's criteria property. now we hookup our dropdownchoice in such a way that it modifies this property and when the page refreshes so will the listview because it is using a detachble model.
Form form=new Form();
add(form);
List filters=new ArrayList();
filters.add("a");
filters.add("b");
form.add(new DropDownChoice("filter", new PropertyModel(this, "criteria"), filters) {
wantOnChangeNotifiaction() { return true; });
// here we glue dropdown choice to our criteria property via the property model
}}
and thats it. to overview what we have done:
the listview "pulls" its filter from the criteria property on the page and uses a detachable model so that it refreshes on every request
dropdown choice puts its selection into the criteria property
so the listview is glued to the dropdown choice by sharing a property
-Igor
On 5/5/06,
Michiel Trimpe <[EMAIL PROTECTED]> wrote:
Hey everybody,
I've just started a Wicket pilot as a possible web-framework to complement Spring and Hibernate at our company and I'm going to need some help.
My first question to the list is, are there any examples of filtered tables??
I get a list from spring with Hibernate managed objects and a list of possible objects and so far I've only been able to add a DropDownChoice and a ListView, but I don't know how to make them work together.
Thanks a lot already and have a nice weekend!
- michiel
Michiel Trimpe | Java Developer| TomTom | [EMAIL PROTECTED] | +31 (0)6 41482341mobile
This e-mail message contains information which is confidential and may be privileged. It is intended for use by the addressee only. If you are not the intended addressee, we request that you notify the sender immediately and delete or destroy this e-mail message and any attachment(s), without copying, saving, forwarding, disclosing or using its contents in any other way. TomTom N.V., TomTom International BV or any other company belonging to the TomTom group of companies will not be liable for damage relating to the communication by e-mail of data, documents or any other information.
