I am Eugene's co-worker.  The entire code block would be unreasonable as it
contains alot of business rules that have nothing to do with the technical
issue.  The basic code summary is this:

Inside a re-usable panel orgPanel:
final DropDownChoice<StructureL> structureDropDown = new
DropDownChoice<StructureL>("StructureL", StructureLList, structureRenderer);
structureDropDown.add(new AjaxFormComponentUpdatingBehavior("onchange") {
  protected void onUpdate(AjaxRequestTarget target) {
    //WHOLE lotta code...I'll cut down to the parts that affect the target.  
    //Note that alot of this is conditional, and different combinations
happen on different conditions
    choiceAppl.setChoices(optionsApps);
    target.addComponent(choiceAppl);
    target.appendJavascript("resetWidth();");
    target.appendJavascript("setWidth();");   

[...]

    target.addComponent(wmc1.setVisible(isVisibleAll));
    target.addComponent(wmc2.setVisible(isVisible));
    target.addComponent(wmc3.setVisible(isVisibleAll));
    target.addComponent(wmc4.setVisible(isVisible));
    target.addComponent(structureDropDown);
    target.appendJavascript("resetWidth();");
    target.appendJavascript("setWidth();"); 
  }
}

Inside a different re-usable panel that is seeking to use the panel but need
to do something extra onchange:

final DropDownChoice struct = (DropDownChoice) orgPanel.get("StructureL");
struct.add(new AjaxFormComponentUpdatingBehavior("onchange") {
  private static final long serialVersionUID = 1L;
  @Override
  protected void onUpdate(AjaxRequestTarget target) {
    onOfficeChange(target, struct, org1, org2, org3, org4);
  }
});

[...]

private void onOfficeChange(AjaxRequestTarget target, DropDownChoice struct,
DropDownChoice org1, DropDownChoice org2, DropDownChoice org3,
DropDownChoice org4) {
  List<String> users = loadUsersByOfficeInfo(target, struct.getInput(),
org1.getInput(), org2.getInput(), org3.getInput(), org4.getInput());
  if(users != null) {
    listUsers.setChoices(users);
    target.addComponent(listUsers);
    listUsersFromOffice.setChoices(users);
    target.addComponent(listUsersFromOffice);
  }
}

Note that the list* controls are both ListMultipleChoice and the structure
control are others within orgPanel are DropDownChoices.

The behavior is that the panel within the panel in my page works fine if i
don't add a second AjaxFormComponentUpdatingBehavior to the same event. 
When I add my second event, the second works perfectly.  But the original is
never called (confirmed by both breakpoint and print statement), breaking
the behavior of that component.

  





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Adding-to-the-existing-AjaxBehavior-of-a-component-tp4657400p4657489.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