Found a solution for this which is to add the 'w2p_component_stop' class 
onto the div, as follows:

  $('#my_target').addClass('w2p_component_stop');
  $('#my_target').html(''); 

this will break the infinite loop set by the call in my original post and 
then will hide the content left from the last iteration of the loop.

Francisco


On Friday, 15 September 2017 03:35:06 UTC+1, Francisco Ribeiro wrote:
>
> Hi all,
>
> I have a monitoring component in which my app continuously grabs data from 
> the database through a controller which is triggered by a javascript call 
> as follows:
>
> $.web2py.component("{{=URL('controller', 'my_function.load')}}", 
> "my_target", timeout=2000, times='Infinity');
>
> As you can see, this component is calling my controller every 2s for an 
> infinite number of times and it works well.
>
> Now, I would like to add an option to allow the user to arbitrarily stop 
> this monitoring component but I could not find a way to trap and stop the 
> JS call above (nor its reload_check) once the page and the component are 
> loaded. Any ideas?
>
> Thank you
> Kind regards,
> Francisco
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to