sorinev
2018-06-07 17:55:12 UTC
Ok, so I found out what it appears to be. My full code for the DropDownChoice
I'm setting up is this:
selectedAccountDropdown = new DropDownChoice("selectedAccount", new
PropertyModel(this, "selectedAccount"), accountList, new
ChoiceRenderer("name", "id"));
selectedAccountDropdown.add(new AjaxFormComponentUpdatingBehavior("change")
{
@Override
protected void onError(AjaxRequestTarget target, RuntimeException e) {
if (e != null) {
LOG.error(e, e);
error(e);
} else {
LOG.error("Exception null, see feedback on page.");
}
error("Page may not have been updated");
target.add(feedbackPanel);
}
@Override
protected void onUpdate(AjaxRequestTarget target) {
//[code here]
}
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
super.updateAjaxAttributes(attributes);
attributes.getAjaxCallListeners().add(new AjaxCallListener()
.onBefore("$('#selectedAccount').prop('disabled',true);")
.onComplete("$('#selectedAccount').prop('disabled',false);"));
}
});
selectedAccountDropdown.setMarkupId("selectedAccount");
selectedAccountDropdown.setNullValid(false);
selectedAccountDropdown.setRequired(true);
baseForm.add(selectedAccountDropdown);
When I comment out the updateAjaxAttributes method, everything works as
expected. If I add it back in, my model object becomes null again when
changing. So, I'm obviously doing that the wrong way. What is the proper way
to achieve what I'm doing on the updateAjaxAttributes override? What I need
to do is disable the dropdown *while* the dropdown is being updated because
there's code that runs that needs to be allowed to finish. I obviously can't
disable/enable the component inside the onUpdate method because those won't
take effect until after onUpdate finishes. Which, clearly, is useless. Hence
the Ajax bits.
--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
I'm setting up is this:
selectedAccountDropdown = new DropDownChoice("selectedAccount", new
PropertyModel(this, "selectedAccount"), accountList, new
ChoiceRenderer("name", "id"));
selectedAccountDropdown.add(new AjaxFormComponentUpdatingBehavior("change")
{
@Override
protected void onError(AjaxRequestTarget target, RuntimeException e) {
if (e != null) {
LOG.error(e, e);
error(e);
} else {
LOG.error("Exception null, see feedback on page.");
}
error("Page may not have been updated");
target.add(feedbackPanel);
}
@Override
protected void onUpdate(AjaxRequestTarget target) {
//[code here]
}
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
super.updateAjaxAttributes(attributes);
attributes.getAjaxCallListeners().add(new AjaxCallListener()
.onBefore("$('#selectedAccount').prop('disabled',true);")
.onComplete("$('#selectedAccount').prop('disabled',false);"));
}
});
selectedAccountDropdown.setMarkupId("selectedAccount");
selectedAccountDropdown.setNullValid(false);
selectedAccountDropdown.setRequired(true);
baseForm.add(selectedAccountDropdown);
When I comment out the updateAjaxAttributes method, everything works as
expected. If I add it back in, my model object becomes null again when
changing. So, I'm obviously doing that the wrong way. What is the proper way
to achieve what I'm doing on the updateAjaxAttributes override? What I need
to do is disable the dropdown *while* the dropdown is being updated because
there's code that runs that needs to be allowed to finish. I obviously can't
disable/enable the component inside the onUpdate method because those won't
take effect until after onUpdate finishes. Which, clearly, is useless. Hence
the Ajax bits.
--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org