On Wed, Aug 1, 2012 at 4:55 PM, Bertrand Guay-Paquet <[email protected]> wrote: > Hi Alex, > > I tried your code and stripped it down as much as possible and couldn't find > anything wrong with it. My guess is that Wicket ajax does not remove timers > from replaced components in ajax responses. Therefore, the javascript > timeout function is still executed on the client even if its related > component is removed from the page.
No. The timer is fired but the precondition prevents the Ajax call. The precondition checks that the component (html element) on which is attached the timer behavior is still in the DOM document. > > Please file a JIRA issue. I suggest using the simpler version below as a > quickstart: > > HomePage.html > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" > "http://www.w3.org/TR/html4/loose.dtd"> > <html xmlns:wicket="http://wicket.apache.org"> > <body> > <a href="#" wicket:id="remove">Replace the panel with attached time > behavior</a><br> > <span wicket:id="fragments">WMC</span> > </body> > </html> > > HomePage.java > import org.apache.log4j.Logger; > import org.apache.wicket.Component; > import org.apache.wicket.util.time.Duration; > import org.apache.wicket.ajax.AbstractAjaxTimerBehavior; > import org.apache.wicket.ajax.AjaxRequestTarget; > import org.apache.wicket.ajax.markup.html.AjaxLink; > import org.apache.wicket.markup.html.WebMarkupContainer; > import org.apache.wicket.markup.html.WebPage; > > public class HomePage extends WebPage { > private static final Logger LOGGER = Logger.getLogger(HomePage.class); > private static final String TIMER_COMPONENT_ID = "fragments"; > > public HomePage() { > Component fragment = new WebMarkupContainer(TIMER_COMPONENT_ID); > fragment.add(new AbstractAjaxTimerBehavior(Duration.seconds(2)) { > @Override > protected void onTimer(AjaxRequestTarget target) { > LOGGER.error("Timeout"); > } > }); > add(fragment.setOutputMarkupId(true)); > > add(new AjaxLink("remove") { > @Override > public void onClick(AjaxRequestTarget target) { > Component fragment = new > WebMarkupContainer(TIMER_COMPONENT_ID); > HomePage.this.replace(fragment); > target.add(fragment); > } > }); > } > } > > Bertrand > > > > On 01/08/2012 3:34 AM, Alex66955 wrote: >> >> TestParent.java >> >> >> TestParent.html >> >> >> TestChild.java >> >> >> TestChild.html >> >> >> Output: >> >> >> >> >> -- >> View this message in context: >> http://apache-wicket.1842946.n4.nabble.com/ComponentNotFoundException-when-replace-a-fragment-with-ajax-tp4650898p4650909.html >> Sent from the Users forum mailing list archive at Nabble.com. >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
