I'd like to run a small piece of javascript code for every component of a list. Right now I output the code in the onRenderHead() callback of a behavior attached to each component:
public class MyBehavior extends Behavior {
@Override
public void renderHead(Component component, IHeaderResponse response) {
response.render(OnDomReadyHeaderItem.forScript(
String.format("my_js_callback('%s')", component.getMarkupId())));
}
}
This works fine.
However now I ajax-refresh the list of component (potentially adding or removing components in the list). How can I make sure the behavior javascript code get called for each component after this ajax-refresh? Is there an easy "wicket way" of doing this? Or should I call some hand-crafted method passing the AjaxRequestTarget context on the way?