Reputation: 3183
Given the following structure within a ModalWindow
I like to make use of the forms toastfeedback panel to display feedback messages before closing the ModalWindow, so i don't have to delegate them to a parent container:
ModalWindow
└─ Content
└─ Form
├─ ToastFeedback (*)
└─ AjaxSubmit
(* display feedback with JavaScript as toast message. Rendered toasts will stay, even when the ModalWindow is removed from DOM)
I'm trying to implement a function to queue another ajax request right after the current has finished. So the new request is a new round trip.
new AjaxButton("submit") {
public void onSubmit(AjaxRequestTarget target, Form<?> form) {
// do the form processing
form.success("all good");
target.add(form);
queueAnotherAjaxRoundTrip();
}
};
Any ideas are pretty welcome here.
Upvotes: 0
Views: 81
Reputation: 17533
You can use target.appendJavaScript("makeAnotherAjaxCall()")
.
makeAnotherAjaxCall
may use jQuery.ajax()
or Wicket.Ajax.xyz()
with or without wrapping the call in setTimeout()
depending on your needs.
If you use Wicket.Ajax
APIs then there is no need of setTimeout
if you use the same AjaxChannel
. If you do not know what is AjaxChannel
then you use the default one and your extra Ajax call will be just queued, as you want.
Upvotes: 0