Why is AjaxEventBehavior onEvent not called with Wicket 8 (worked ok with Wicket 7)?

395 views Asked by At

I migrated from Wicket 7 to Wicket 8. Now OnLoadBehavior does not work anymore. I need to show some hidden fields in the view using target.add() inside onEvent e.g.

if (showDateElement) {
   dateElement.setVisible(true);
   target.add(dateElement);
}

Issue is that method onEvent is not called anymore as it was in previous version. No other code changes. This occurs in Firefox. Chrome seems to work most of the time, but not always. Is there some other way to do this same reliably in Wicket 8?

I hope someone can help.

add(new OnLoadBehavior());

private final class OnLoadBehavior extends AjaxEventBehavior {

    private OnLoadBehavior() {
        super("load");
        LOG.debug("OnLoadBehavior");
    }

    @Override
    protected void onEvent(final AjaxRequestTarget target) {
        LOG.debug("OnLoadBehavior onEvent");
    }
}
0

There are 0 answers