Thanks a lot Niphlod. Actually that was the case. I started to use web2py 
2.4.6 but my app was built using web2py 1.99.7. I updated web2py.js, 
web2py_ajax.html and layout.html. It works now. But if I want to refresh 
the component in every 30 seconds, I am having a problem. Sometimes 
pagination links or sorting links are not trapped. How can I refresh the 
component properly?

The following helps to refresh, but links are not trapped in some cases. 

in container.html:

{{extend 'layout.html'}}

{{=frag}}

<script>
jQuery(document).ready(function(){
var auto_refresh = setInterval(
function()
{
$('#mydiv').load('{{=URL(r=request,c='default',f='thisgrid.load' )}}'); 
}, 30000);
});
</script>

in controller (target is added):

def container():
    frag = LOAD('default', 'thisgrid.load', ajax=True, target='mydiv')
    return dict(frag=frag)


On Friday, August 2, 2013 1:24:22 PM UTC-7, Niphlod wrote:
>
> did you start with an old (pre 2.6.0) app and updated web2py ? if yes, you 
> need to overwrite your app's web2py.js with welcome/static/web2py.js
> I think that the most straightforward example is (assuming working on 
> localhost, hence having generic views enabled): take your welcome, put this 
> in default.py
>
> def thisgrid():
>     grid = SQLFORM.grid(db.your_table, paginate=5) #paginate defaults 
> altered just to avoid having a huge test table filled for this test
>     return dict(grid=grid)
>
> def container():
>     frag = LOAD('default', 'thisgrid.load', ajax=True)
>     return dict(frag=frag)
>
>
> then access the container page.
>

-- 

--- 
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/groups/opt_out.


Reply via email to