if you have a piece of script that *depends/works on/does something to* on 
elements placed in the LOAD()ed component, you need to initialize the 
"piece" inside the LOAD()ed fragment, not on the one containing it.

On Tuesday, February 17, 2015 at 10:36:22 AM UTC+1, Gael Princivalle wrote:
>
> Hello all.
>
> I have in a web site a lateral menu with categories that change datas in a 
> .load file, displayed in a div, with ajax.
> Something like that:
> A link in the lateral menu:
> {{=A(category.name,callback=URL('prod','prod.load', vars=dict(category_id=
> category.id), user_signature=True), target="div_prod")}}
>
> The div where I display the datas:
> {{=LOAD('prod','prod.load', ajax=True, target='div_prod')}}
>
> It works fine.
>
> I've add Facebook button's Like and Share without problems in the layout 
> like that:
> At the beginning of the body:
>         <div id="fb-root"></div>
>         <script>(function(d, s, id) {
>           var js, fjs = d.getElementsByTagName(s)[0];
>           if (d.getElementById(id)) return;
>           js = d.createElement(s); js.id = id;
>           js.src = "//
> connect.facebook.net/it_IT/sdk.js#xfbml=1&version=v2.0";
>           fjs.parentNode.insertBefore(js, fjs);
>         }(document, 'script', 'facebook-jssdk'));</script>
>
> At the end of the body:
>             {{if request.function != 'products':}}
>                 <div class="page-content">
>                     <div class="container">
>                         <div class="fb-like" 
> data-href="{{=URL(args=request.args, 
> vars=request.vars, scheme=True, host=True)}}" data-layout="button_count" 
> data-action="like" data-show-faces="true" data-share="true"></div>
>                     </div>
>                 </div>
>             {{pass}}
>
> Now I would like to link these buttons to specific products.
> I've put a test in the layout for not displaying the facebook buttons if 
> the page is "products" .
> So I would be able to add these buttons inside the .load file.
>
> The problem is that there are displayed (so processed by Facebook script) 
> only when the complete page product.html is loaded.
> If I stay on the products page changing datas in the .load file, buttons 
> are not displayed.
>
> Someone have a solution or almost an explanation ?
>
> Thanks, regards.
>
>
>
>

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