Hi,

I have searched for this problem and read many entries but I can't seem to
figure it out. I have two problems:

1. When instantiate my ListView with Check checkboxes they are always
checked by default. I can't manage to uncheck them by default.

2. Once I have chosen items from my list via the checkboxes and submitted
the form depending on how many checkboxes have been checked, that amount of
rows just disappears from the bottom of my list. It doesn't matter which
boxes I check, it's always the rows from the bottom up that disappear.

It would be really great if anyone could help, thanks you in advance.

Here is my code:

// initialize CheckGroup
        this.checkGroup = new CheckGroup("checkgroup", new
CompoundPropertyModel(this.someList));
        someForm.add(checkGroup);
        
        // initialize ListView
        this.listView = new ListView<String[]>("someList", new
CompoundPropertyModel(this.someList)) {

            @Override
            protected void populateItem(ListItem item) {
                String[] array = (String[]) item.getModelObject();
                item.add(new Check("checkbox", item.getModel()));
                item.add(new Label("label1", array[0]));
                item.add(new Label("label2", array[1]));
                item.add(new Label("label3", array[2]));
            }
        };
        this.listView.setReuseItems(true);
        checkGroup.add(this.listView);


protected void onSubmit() {
                LinkedList<String[]> list =
((LinkedList<String[]>)checkGroup.getModelObject());
                
                for(int i=0; i<list.size(); i++) {
                    //do stuff with the list
                }
            };



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Listview-Checkbox-checked-by-default-and-disapearing-after-submit-tp4654605.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to