# -*- coding: utf-8 -*-
AJ_FROM_SERVER = True
UPD_TIMEOUT = 6000
def reload_btn(s):
return DIV(T('RELOAD'),
_onclick = 'ajax("%s", [], "reload_tag")' %
URL('aj_load2','reload'),
_class='btn btn-info')
def reload():
session.counter = (int(session.counter or 0)) + 1
# reload component
response.js = "jQuery('#show_1').get(0).reload();"
#response.js += "jQuery('#show_2').get(0).reload();"
return CAT(
request.now,' ',
session.counter,
SCRIPT('$("html,body").animate({"scrollTop":50},"slow");')
)
def show2():
session.show2 = (int(session.show2 or 0)) + 1
h=CAT(
SCRIPT("""
if ( ! $('#show_2').is(':visible')) {
$('#show_2').animate({ height: 'show' }, 1000);
}
"""),
H4('SHOW 2'),
T('COUNTER 2'),': ',session.show2,
)
h += reload_btn(1)
return h
def show1():
session.show1 = (int(session.show1 or 0)) + 1
session.show2 = 1
h = CAT(
SCRIPT("""
if ( ! $('#show_1').is(':visible')) {
$('#show_1').animate({ height: 'show' }, 1000);
}
"""),
H4('SHOW 1'),
T('COUNTER 1'),': ', session.show1,
)
h += LOAD('aj_load2', 'show2', args=[], ajax=True,
times = 'infinity', timeout=UPD_TIMEOUT,
target='show_2', # instead _id
_style='display:none; height:0%;',
_class='container',
)
return h
def index():
response.title = None
#session.forget(response)
session.forget(request)
h = CAT()
h += reload_btn(1)
h += DIV(_id = 'reload_tag')
h += LOAD('aj_load2', 'show1', args=[], ajax=True,
times = 'infinity', timeout=UPD_TIMEOUT * 5,
target='show_1',
_style='display:none; height:0%;',
_class='container',
)
return dict( h = DIV(h, _class='row'))
but after reload show_1 reladind of show_2 do doubles reloads ((
понедельник, 13 апреля 2015 г., 23:00:39 UTC+3 пользователь Richard написал:
>
> Hello,
>
> I create a page with multiple components inside of it (the index page is
> basically an empty shell for the components)... But one of there is a form
> in one of the embed component which as a field with a widget that trigger
> modal form allowing to insert a value in another table and select this
> inserted value (something like SELECT_OR_ADD() would do). The problem is
> that my form embeded in the modal which the widget append to the page with
> LOAD() don't load... It hang on "loading..."
>
> Any idea?
>
> Is it even possible to trigger a LOAD inside a LOAD?
>
> Thanks
>
> Richard
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.