Hey,
I have a panel that consists of two parts:
the first lists groups names.
the second lists the contacts of a group, which gets
populated upon clicking on the group name (via Ajax).
<wicket:panel>
<div>
<div wicket:id="groups">
<span wicket:id="name">Group Name</span>
</div>
</div>
<div>
<div>
<table wicket:id="contactsTable">
<tr wicket:id="contacts">
<td><span wicket:id="gsm">number</span></td>
</tr>
</table>
</div>
</div>
</wicket:panel>
I created this model:
public class ContactsModel extends
LoadableDetachableModel {
private Long groupId;
@SpringBean
private Service service;
public ContactsModel(Long groupId) {
InjectorHolder.getInjector().inject(this);
this.groupId = groupId;
}
@Override
protected Object load() {
return service.findContactsByGroupId(groupId);
}
}
And here is a snippet from the panel class:
ListView entry = new ListView("groups",
new GroupsModel()) {
@Override
protected void populateItem(ListItem item) {
Group group = (Group) item.getModelObject();
item.setModel(new CompoundPropertyModel(group));
item.add(new AjaxFallbackLink("") {
@Override
public void onClick(AjaxRequestTarget target) {
//what to do?
}
});
}
};
Yes, inside onClick I can get the group ID, but what to do?
I have to do something like this inside onClick:
ContactsModel cm = new ContactsModel(groupId);
What to put inside onClick() ?
I'm new to Wicket so I appreciate your time.
Thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]