How can I correctly add (by Ajax) and remove (by Ajax) an AjaxSelfUpdatingTimerBehavior?

View: New views
3 Messages — Rating Filter:   Alert me  

How can I correctly add (by Ajax) and remove (by Ajax) an AjaxSelfUpdatingTimerBehavior?

by dideep :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

Is it possible to correctly add and then remove an
AjaxSelfUpdatingTimerBehavior from a component, all by Ajax?  At the
moment I'm running into problems - the browser gets a "Page Expired"
response soon after I remove the behavior.  I think I have an idea why
it doesn't work in its current form - is there any way to get
something similar working?

Thanks,
Ambrose

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: How can I correctly add (by Ajax) and remove (by Ajax) an AjaxSelfUpdatingTimerBehavior?

by reiern70 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Remember having the same problem with panel and I have dome something like

for(Object behavior : getBehaviors()) {
if(behavior instanceof AjaxSelfUpdatingTimerBehavior) {
remove((AjaxSelfUpdatingTimerBehavior)behavior);
}
}
add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(1000)));
So, that refresh is delayed a lot... but now that I look to it again I see
there is an stop() method on AbstractAjaxTimerBehavior.

Regards,

Ernesto

On Mon, Nov 2, 2009 at 12:20 PM, Ambrose Wheatcroft <
ambrosewheatcroft@...> wrote:

> Hello,
>
> Is it possible to correctly add and then remove an
> AjaxSelfUpdatingTimerBehavior from a component, all by Ajax?  At the
> moment I'm running into problems - the browser gets a "Page Expired"
> response soon after I remove the behavior.  I think I have an idea why
> it doesn't work in its current form - is there any way to get
> something similar working?
>
> Thanks,
> Ambrose
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>

Re: How can I correctly add (by Ajax) and remove (by Ajax) an AjaxSelfUpdatingTimerBehavior?

by dideep :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Okay,

So I got it working.  As you suggest - stop() works.  I then also
store the behavior so that it can be removed permanently on a later
Ajax trip.  That way I can keep adding and removing timers with
different intervals.

Thanks!

2009/11/2 Ernesto Reinaldo Barreiro <reiern70@...>:

> Remember having the same problem with panel and I have dome something like
>
> for(Object behavior : getBehaviors()) {
> if(behavior instanceof AjaxSelfUpdatingTimerBehavior) {
> remove((AjaxSelfUpdatingTimerBehavior)behavior);
> }
> }
> add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(1000)));
> So, that refresh is delayed a lot... but now that I look to it again I see
> there is an stop() method on AbstractAjaxTimerBehavior.
>
> Regards,
>
> Ernesto
>
> On Mon, Nov 2, 2009 at 12:20 PM, Ambrose Wheatcroft <
> ambrosewheatcroft@...> wrote:
>
>> Hello,
>>
>> Is it possible to correctly add and then remove an
>> AjaxSelfUpdatingTimerBehavior from a component, all by Ajax?  At the
>> moment I'm running into problems - the browser gets a "Page Expired"
>> response soon after I remove the behavior.  I think I have an idea why
>> it doesn't work in its current form - is there any way to get
>> something similar working?
>>
>> Thanks,
>> Ambrose
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...