Try item.add(new CheckBox("checkbox", new
PropertyModel(item.getModel(),"selected")));
Also data.setReuseItem(true) might help.

Maurice

On Thu, Mar 20, 2008 at 7:30 AM, tsuresh <[EMAIL PROTECTED]> wrote:
>
>   Hello wicketeers,
>  I have sectors which contains subsectors. subsectors contains the selected
>  as boolean and name of subsector. When a sector is selected, I need to
>  display the list of sub sectors and the check box checked/unchecked
>  according to it stored in database. I did this as the code below. The
>  problem is that I can't edit the list again. For example if Sector 1 has two
>  subsectors   sectorA (checked) and sectorB unchecked. When I edit this i.e
>  check both sub sectors, the result is blank. I know I am missing something.
>  Please help.
>
>
>        public SubSectorPanel(String id, Sector s) {
>         super(id);
>         subSectorList = s.getSubSectors();
>
>
>        ListView data = new ListView("rows", subSectorList) {
>
>             public void populateItem(final ListItem item) {
>                SubSector ses = (SubSector) item.getModelObject();
>                   item.add(new CheckBox("checkbox", new PropertyModel(ses,
>  "selected")));
>                 item.add(new Label("name", ses.getName()));
>             }
>         };
>           Form form = new Form("addform") {
>
>             protected void onSubmit() {
>                 // how to get selected items here?
>
>             }
>         };
>      form.add(data);
>
>  thanks
>  --
>  View this message in context: 
> http://www.nabble.com/Display-selected-items-in-check-boxes.-tp16172677p16172677.html
>  Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  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