wicket.markup.html.form.CheckGroup
[back to the reference]A CheckBoxGroup and CheckBoxComponnet components let users select multiple values from a group of checkboxes. These components are more flexible then the CheckBoxMultipleChoice component in that individual checkboxes are full components, unlike with CheckBoxMultipleChoice, and thus can be used anywhere in the markup.
Behind the Scenes
Example HTML
<form wicket:id="form">
<span wicket:id="group">
<input type="checkbox" wicket:id="groupselector">check/uncheck all</input>
<tr wicket:id="persons">
<td><input type="checkbox" wicket:id="checkbox"/></td>
<td><span wicket:id="name">[this is where name will be]</span></td>
<td><span wicket:id="lastName">[this is where lastname will be]</span></td>
</tr>
</span>
</form>
Example Code
Form f=new Form("form");
add(f);
CheckGroup group=new CheckGroup("group");
form.add(group);
group.add(new CheckGroupSelector("groupselector"));
ListView persons=new ListView("persons", getPersons()) {
protected void populateItem(ListItem item) {
item.add(new Check("check", item.getModel()));
item.add(new Label("name", new PropertyModel(item.getModel(), "name")));
item.add(new Label("lastName", new PropertyModel(item.getModel(), "lastName")));
};
persons.setReuseItems(true);
group.add(persons);