that is an inelegant approach imho, this is how i would do it

class MyPage extends WebPage {
   private Set selected=new HashSet();

   public MyPage() {

     add(new DataView(...) {

            populateItem(item) {
                MyObject o=(MyObject)item.getModel();
               item.add(new CheckBox("cb", new CheckedModel(o.getId());
              ... }

  });

  }

  private class CheckedModel extends AbstractCheckBoxModel {
      private final long id;

      public SelectedPersonModel(long id) { this.id=id; }

       public void setSelected(Component c, boolean sel) {
           if (sel) { selected.add(id); } else { selected.remove (id); }
      }

      public void isSelected(Component c) { return selected.contains(id); }
}
   
}


then after the form submit read the selected set for selected ids. if you have paging you need to write your own navigator that uses submitlink instead of link....or use an ajax checkbox

-Igor


On 9/9/06, Martijn Dashorst <[EMAIL PROTECTED]> wrote:
Does your Java object that is in your list have a boolean property?

The checkboxes will set that value.

Martijn


On 9/9/06, Erik Brakkee <[EMAIL PROTECTED]> wrote:
> Erik Brakkee wrote:
> > Hi,
> >
> > I was just wondering how to do the following:
> > 1. display a number of items together with a checkbox in a table using
> > DataView.
> > 2. in the submission of a form check which items are checked.
> >
> > The data is coming from a database so a DataView would seem a good choice.
> > How do I go about something like this with wicket?
> >
> Let me rephrase: It is easy to implement a IDataProvider and put all
> kinds of content on it like e.g. checkboxes.
> The main problem is in an onSubmit() of a form to tell which items are
> actually shown on the current page.
> How do I do that?
>
> > Cheers
> >   Erik
> >
> > -------------------------------------------------------------------------
> > Using Tomcat but need to do more? Need to support web services, security?
> > Get stuff done quickly with pre-integrated technology to make your job easier
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > _______________________________________________
> > Wicket-user mailing list
> > Wicket-user@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>


--
Download Wicket 1.2.2 now! New Ajax components: Tree, TreeTable and ModalWindow
-- http://wicketframework.org

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to