if (!canrefresh()) { settimeout( <add original script )} else { <original script> }
-igor On Wed, Oct 13, 2010 at 4:37 AM, Maris Orbidans <maris.orbid...@ingg.com> wrote: > Hi > > I need to periodically update a page unless some condition is met. > I wrote javascript function canRefresh() and added like this: > > add(new AbstractAjaxTimerBehavior(Duration.seconds(5)) { > �...@override > protected void onTimer(final AjaxRequestTarget target) { > updateSessionConfigPanel(target); > } > > @Override > protected CharSequence getCallbackScript() { > return "if (!canRefresh()) {"+ super.getCallbackScript()+"};"; > } > }); > > This is generated javascript. > > <script type="text/javascript" ><!--/*--><![CDATA[/*><!--*/ > Wicket.Event.add(window, "load", function(event) { setTimeout("if > (!canRefresh()) {var > wcall=wicketAjaxGet('?wicket:interface=:0::IActivePageBehaviorListener:1 > :&wicket:ignoreIfNotActive=true',function() { }.bind(this),function() { > }.bind(this));};", 5000);;}); > /*-->]]>*/</script> > > The problem is that once canRefresh() returns false timer stops. Is it > possible to restart it? Or a better way to implement conditional > update? > > > Maris > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org