On Saturday, June 11, 2011 8:47:05 PM UTC-4, 黄祥 wrote: 
>
> thank you so much for your hints, anthony, i've already move out the hidden 
> class div but got the same results, the components show as a loading.... 
> i don't know where is the problem.
>
 
I'm not sure exactly where your problem is. The following very simple 
example works for me:
 
In default.py controller:
 
def index():
    return dict()
 
def component1():
    form=FORM('Comment:', INPUT(_name='comment'), INPUT(_type='submit'))
    if request.vars:
        response.js='web2py_component(action="%s", target="%s")' % 
(URL('component2'), 'component2')
    return dict(form=form)
 
def component2():
    return dict(time=request.now)
 
 
In default/index.html view:
 
{{extend 'layout.html'}}
 
<h2>Enter Comment</h2>
{{=LOAD('default','component1.load',ajax=True)}}
 
<h2>Time</h2>
{{=LOAD('default','component2.load',target='component2',ajax=True)}}
 
 
When I submit a comment in component1, it causes the time to be updated in 
component2. So, it is possible to set response.js in one component to reload 
another component. You must have an error somewhere else in your code. I 
would say start with something simple like my code above that you can get to 
work, and then gradually add in the additional complexity of your code, and 
see where it breaks.
 
Anthony
 
 

Reply via email to