Reputation: 309
I'm adding a FeedbackPanel to my web page, with the expectation that it would refresh whenever a component responds to an Ajax Behavior. To do this, I am overriding the onEvent method in my page like so:
@Override
public void onEvent(IEvent<?> event) {
Object payload = event.getPayload() ;
if ( payload instanceof AjaxRequestHandler) {
AjaxRequestHandler target = (AjaxRequestHandler)payload ;
target.add(console); // console is the FeedbackPanel instance
}
super.onEvent(event);
}
It works reasonably well in the sense that the FeedbackPanel is refreshed, but now with any new Ajax event the panel is cleared. What is displayed are messages that were created with info("...");
by the component that responded to the Ajax event.
I'd like to have the messages persisting.
What am I doing wrong?
Thanks! Eric
Upvotes: 0
Views: 381
Reputation: 17533
Check org.apache.wicket.settings.ApplicationSettings#setFeedbackMessageCleanupFilter()
. By default Wicket uses a feedback cleanup filter that deletes all rendered feedback messages. Once the FeedbackPanel re-renders itself in an Ajax request it marks as rendered all feedback messages reported in this Ajax request.
You will have to replace it with a custom implementation that decides when to cleanup/delete the messages.
Upvotes: 1