Here is the full code. This is an urgent problem so any advice much
appreciated.

ISSUE: Cannot enable/disable Checks in an Ajax update, their state remains
the same.

The Checks in the CheckGroup are supposed to change depending on a DropDown
change.

1) On Page Construction, all Checks in the CheckGroup are initially enabled

final CheckGroup appsCheckGroup=new CheckGroup("apps");
appsCheckGroup.setOutputMarkupId(true);
add(appsCheckGroup);
ListView appListView = new ListView("appList", appList) { 
        @Override
        protected void populateItem(ListItem arg0) {

                Check app = new Check("app", arg0.getModel(), appsCheckGroup);
                ApplL appObject = (ApplL)arg0.getModelObject();
                app.add(new 
SimpleAttributeModifier("title",appObject.getApplDc()));
                arg0.add(app);

                         *app.setEnabled(true);*

        Label lblApp = new Label("lblApp", appObject.getApplCd());
        lblApp.add(new SimpleAttributeModifier("title", appObject.getApplDc()));
        arg0.add(lblApp);
        }
};
appListView.setReuseItems(true);
appsCheckGroup.add(appListView);


2) In the Ajax Request (invoked from a separate DropDown):

structureDropDown.add(new AjaxFormComponentUpdatingBehavior("onchange")
{
                final CheckGroup appsCheckGroup = 
(CheckGroup)UM01SearchForm.get("apps"); 

                ListView appListView = new ListView("appList", appList) {

                @Override
                protected void populateItem(ListItem arg0) {
                        Check app = new Check("app", arg0.getModel(), 
appsCheckGroup);

                        System.out.println("In Ajax ListView.populateItem");

                        ApplL appObject = (ApplL)arg0.getModelObject();
                        app.add(new 
SimpleAttributeModifier("title",appObject.getApplDc()));                        
            

                        *app.setEnabled(false);*                                
        

                        arg0.add(app);
                Label lblApp = new Label("lblApp", appObject.getApplCd());
                lblApp.add(new SimpleAttributeModifier("title", 
appObject.getApplDc()));
                arg0.add(lblApp); 
                }
        };

        appListView.setReuseItems(true);
        appsCheckGroup.addOrReplace(appListView);

        System.out.println("In Ajax addComponent");

        target.addComponent(appsCheckGroup.setRenderBodyOnly(false));

        }

}

OUTPUT:
1) None of the checkboxes changes state after the Ajax update (but the Ajax
request is processed)
2) The line "In Ajax addComponent" happens BEFORE the line "In Ajax
ListView.populateItem"

I've also tried directly accessing the Checks inside the CheckGroup, but
that didn't work for me, the state still doesn't change: e.g., for Check #3,

// Direct Access Test
Check c3 =
(Check)((ListItem)((ListView)appsCheckGroup.get("appList")).get("3")).get("app");
c3.setEnabled(false);
target.addComponent(c3);


Thanks for any help.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Disabling-Individual-Checkboxes-in-CheckGroup-tp4658165p4658366.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to