For some reason my Eclipse / Jetty plugin wasn’t updating the code before running.

 

This works and it’s a thing of beauty!

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mark Southern
Sent: Friday, March 17, 2006 9:34 AM
To: [email protected]
Subject: [Wicket-user] AjaxCheckBox updated twice per request

 

Fixed the _javascript_/ajax problem thank you.

 

What is now happening however is that although the ajax request is sent, the checkbox is updated twice, setting it back to it’s selected state. I cannot see why this would be the case.

 

This is the only code relating to the checkbox:

 

              final PagedTableWithAlternatingRowStyle table = new PagedTableWithAlternatingRowStyle("rows", data, 5)

              {

                  public void populateItem(final ListItem listItem)

                  {

                      super.populateItem(listItem);

                     

                      final SampleBean value = (SampleBean) listItem.getModelObject();

 

                      final AjaxCheckBox checkBox = new AjaxCheckBox("checkbox", new PropertyModel(value,"selected"))

                      {

                        public void onUpdate(AjaxRequestTarget target)

                              {

                                    System.out.println("Ajax update");

                                    target.addComponent(this);

                              }

                      };

                      listItem.add(checkBox);

 

 

 

and in my Model Bean;

 

 

      public void setSelected(Boolean selected) {

            System.out.println("selected: " + selected);

            this.selected = selected;

      }

 

 

The debug output is;

 

 

selected: false

Ajax update

selected: true

Reply via email to