• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Prototype: Ajax.PeriodicalUpdater keeps running after container is removed or changed

Hi there, I have a question about Ajax.PeriodicalUpdater,

I hope don't bother nobody.

If you use PeriodicalUpdater to return data to fill a component, such as a DIV, and that div is then deleted or changed, the PeriodicalUpdater continues to run, How can I solve this? I have been searching in net, but I can't get the solution.


[eluser]Mike Ryan[/eluser]

PeriodicalUpdater has a 'stop' method, which will prevent it from running.

Yes is true, the "stop" method works fine before the reload the div container, the problem if after reload the div container, the PeriodicalUpdater continuous running.

[eluser]Mike Ryan[/eluser]
That would suggest it is being stopped and then restarted. Maybe you could check (on reload) to see if PeriodicalUpdater should be started again?

Is the Updater code stored within the div that gets reloaded? If so, moving it out of that div should help, as it won't get restarted on reload.

My code looks in that way:

<div id='dropdown'>
<select name="category"><option></option></select>
When the select change the DIV container is reload.

<div id='container'>
The page load here has the PeriodicalUpdater
The code load here works fine, and stop when some part of the code in the success function is triggered, the issue is presented if I change the dropdown before the stop method is called, the div is reload with another page and the PeriodicalUpdater charged before is still running.

I hope to be clear, this is driving me crazy!

[eluser]Mike Ryan[/eluser]
How about calling the stop function immediately after the item in the dropdown box is selected? That should stop the 'old' PeriodicalUpdater before the 'new' one starts.

Well, I tried and didn't work, but even if that work fine, I think is a dirty way, imagine if my select has ten diferents options and all of this load diferent PeriodicalUpdater, I should always stop all the PeriodicalUpdater in ten diferents ways ?

[eluser]Mike Ryan[/eluser]
If it doesn't work it's a moot point, but I would just do it once in the 'selected/clicked' function for the dropdown rather than once for each item.

Have I understood the problem correctly - you want the PU to stop after you select the item in the dropdown right?

Yes this is the issue, I'm going to try with the observe function in the div, in the select, And calling the stop function immediately after the item in the dropdown box is selected like you said.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.