Maybe you can try IHeaderResponse.renderOnDomReadyJavascript 2010/9/7 Joseph Pachod <j...@thomas-daily.de>
> hi > > I've some components which require some client side javascript which > require one init call (for all) to be initialized. In fact, this init call > uses selectors to get at the components to work one. > > My issues is with Ajax. It happens that, during it, some new components > required this init call are added. > > As such, how could I trigger it only once per Ajax request ? > > The pattern I'm targeting is for each component to initialize this way to > have a behavior in which something would be added only in Ajax request > cycle. For non ajax request cycle, I use jquery to do the init, through: > $(document).ready(function(){ > $.initEdit(); > }); > > When trying to reach this goal, I tried to run the init call through an > header contributor, but the call is then done before my content is put on > the page, making it useless: > public abstract class AbstractEditBehavior extends AbstractBehavior > { > public AbstractEditBehavior(final AbstractTextComponent<?> component) > { > component.add(JQueryDependency.CORE); > component.add(new HeaderContributor(new IHeaderContributor() > { > public void renderHead(final IHeaderResponse response) > { > if ((AjaxRequestTarget.get() != null)) > { > response.renderJavascript("jQuery.initEdit();", "ID" > + response.hashCode()); > } > } > })); > > } > (...) > > thanks in advance > best > -- > > Joseph Pachod > IT > > THOMAS DAILY GmbH > Adlerstraße 19 > 79098 Freiburg > Deutschland > T + 49 761 3 85 59 506 > F + 49 761 3 85 59 550 > E joseph.pac...@thomas-daily.de > www.thomas-daily.de > > Geschäftsführer/Managing Directors: > Wendy Thomas, Susanne Larbig > Handelsregister Freiburg i.Br., HRB 3947 > > Registrieren Sie sich unter https://www.thomas-daily.de/user/sign-in für > die TD Morning News, eine kostenlose Auswahl aktueller Themen aus TD > Premium, morgens ab 9:15 in Ihrer Mailbox. > > Aktuelle Presseinformationen für die TD Morning News und TD Premium nimmt > unsere Redaktion unter redakt...@thomas-daily.de entgegen. > Redaktionsschluss für die TD Morning News ist täglich um 8:45. > > Register free of charge at https://www.thomas-daily.de/user/sign-in to > have the TD Morning News, a selection of the latest topics from TD Premium, > delivered to your mailbox from 9:15 every morning. > > Our editorial department receives the latest press releases for the TD > Morning News and TD Premium at redakt...@thomas-daily.de. The editorial > deadline for the TD Morning News is 8.45am daily. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > -- BUQUET Fabrice