I have the following general setup:

Main Page - basically just a container that holds the...

...Infinite Pagination Pictures Component - loads 10 pictures and my 
comment() component (one for each picture), which when clicked, opens the...

...Picture Modal - a component that loads in a modal on top of the other 
component to display the picture you clicked on.


I use LOAD() for all of these.  Here's my problem:  If I try to load my 
comment() component in the modal as well, all the comment() components in 
the Infinite Pagination Pictures Component reload as well.  I have separate 
namespaces based on whether comment() is in a modal or not, but this seems 
linked to my need to put "{{include 'web2py_ajax.html'}}" in the view of 
any component that has components within it.  

Is it just not supported to have a sub-component load a component that is 
also present in the parent-component?  I actually created an infinite loop 
doing something similar not long ago.

As a workaround, I've been loading the component with JS calling AJAX, 
which works fine:

//- Load the comments component.
span(id="load-comments" 
data-url="{{=URL('social', 'comments', 'comments.load', 
vars=dict(pic_id=pic_id, comment_open='True'))}}" 
data-target="pics-comment-container")
//- AJAX container to load comments.
div(id="pics-comment-container")
//- AJAX call to load comments in the appropriate container.
script.
$(document).ready(function (e) {
elem = $('#load-comments'); // elem = $(e.target)
url = elem.attr("data-url");
target = elem.attr("data-target");
web2py_ajax_page("GET", url, "", target);
return false; // e.preventDefault()
});


-- 
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