Jurrie,

this goes very well. I use check boxes in repeaters for the same reason. Just have a look at the following snippets.

....
dynamicContents.add(listView = new DataView("whatever", getDataProvider(), 15)
       {
           @Override
           protected void populateItem(Item listItem) {
final Whatever whatever = (Whatever)listItem.getModelObject();

//log.debug("populateItem() whatever="+whatever.getControlnumber()+" => "+selection.contains(whatever.getId())); final SelectionModel<Whatever> selectionModel = new SelectionModel<Whatever>(whatever, selection.contains(whatever.getId())); final CheckBox checkBox = new AjaxCheckBox("selected", selectionModel) {
                   @Override
                   public void onUpdate(AjaxRequestTarget target) {
                       Boolean selected = selectionModel.getObject();
                       Long id = selectionModel.getSelection().getId();
                       if (selected)
                           selection.add(id);
                       else
                           selection.remove(id);
log.debug("selected.onUpdate: "+selected+" for id="+id);
                   }
               };
               checkBox.setOutputMarkupId(true);
               checkBox.setVisible(selectionEnabled);
selectionBoxes.put(selectionModel, checkBox); listItem.add(checkBox); listItem.add(new Label("dmcControlnumber", new PropertyModel(whatever, "controlnumber")));
...

This requires a simple class what simply reflects the selection state of the selected/unselected rows collected in a map. It is a bit tricky if you start up with some rows already selected and dataproviders supporting lazy loads . Then you might have to setup the selection models on creation only for visible rows and merge afterwards.

Best regards
Hannes

Jurrie Overgoor wrote:
Hello everyone,

I'm currently creating a Wicket application, and for this I need a repeater that lets the user select multiple rows from a list of items. So basically a repeater that adds a checkbox in front of every item. Is this component available? I remember seeing this somewhere, but I forgot where, and I can't seem to find it again.

------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to