[web2py] Re: console.log on page reload?

2015-11-05 Thread Derek
put it in new.html not web2py_ajax

On Thursday, October 1, 2015 at 4:54:33 PM UTC-7, Tom Campbell wrote:
>
> Thank you, Derek, but I'm still flummoxed. I added this new script tag to 
> web2py_ajax.html:
>
> console.log('loaded ' + Date.now())
>
> But I'm getting this message even when I use LOAD(). So I'm trying to 
> understand whether I am placing this code in the wrong location or what, 
> because I think it shouldn't be redrawing the page. The XHR record output 
> seems to confirm this.
>
> FWIW the actions are called this way from menu.py:
>
> response.menu = [
> ('Demo', False, '', [
> (T('New task'), False, URL('default', 'new')),
> (T('Show all tasks'), False, URL('default', 'all')),
> ]),
> ]
>
>

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


[web2py] Re: console.log on page reload?

2015-10-01 Thread Derek
You don't need that, just do this...

console.log('loaded ' + date())

On Thursday, October 1, 2015 at 4:01:14 PM UTC-7, Tom Campbell wrote:
>
> Working on a single-page app and trying to ensure that only part of the 
> page gets refreshed. Doing some tests using LOAD() that look like this:
>
> *file default/new.html:*
>
> {{extend 'layout.html'}}
> {{=LOAD('default', 'new.load',ajax=True)}}
>
> *file default/new.load:*
>
> {{if 'message'in globals():}}
> {{=message}}
> {{pass}}
> {{=form}}
>
> I added this detection code to* web2py_ajax.html*:
>
> 
>
> But the refresh seems to be called every time I choose the action. 
> However, when viewing the console output in Chome I get the hoped-for 
> message starting with:
>
> RELOADED Thu Oct 01 2015 15:36:45 GMT-0700 (PDT)
>
> XHR finished loading: GET "http://127.0.0.1:8000/spa1a/default/new.load;
> etc.
>
> What am I doing wrong?
>
>

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


[web2py] Re: console.log on page reload?

2015-10-01 Thread Tom Campbell
Thank you, Derek, but I'm still flummoxed. I added this new script tag to 
web2py_ajax.html:

console.log('loaded ' + Date.now())

But I'm getting this message even when I use LOAD(). So I'm trying to 
understand whether I am placing this code in the wrong location or what, 
because I think it shouldn't be redrawing the page. The XHR record output 
seems to confirm this.

FWIW the actions are called this way from menu.py:

response.menu = [
('Demo', False, '', [
(T('New task'), False, URL('default', 'new')),
(T('Show all tasks'), False, URL('default', 'all')),
]),
]

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