aj = "ajax('%s',[],'main')"
response.menu = [
    (T('Home'), URL('default', 'index')==URL(), URL('default', 'index'), 
[]),
    (T('Menu1'), URL('default', 'menu1')==URL(), dict(_onclick=aj % 
URL('default', 'menu1')), []),
    (T('Menu2'), URL('default', 'menu2')==URL(), dict(_onclick=aj % 
URL('default', 'menu2')), []),
]


in default.py
def menu1():
    return 'menu1'
def menu2():
    return 'menu2'





воскресенье, 19 апреля 2015 г., 3:05:02 UTC+3 пользователь Gary Cowell 
написал:
>
> Hello
>
> I'm struggling with components, with ajax. I've been trying to follow 
> examples in the book and blog and not getting very far. 
>
> I have an application that's based on five controller functions, with a 
> page each. Each page has the same header at the top, and the bottom two 
> thirds of the page holds the form for that page. This clearly means that 
> when I choose a new menu option, I get a page refresh.
>
> So what I thought I wanted to do, was have the bottom two thirds of the 
> page hold a div and component, but a generic div into which I would load my 
> required form for the menu option that was just selected.
>
> So my menu options would cause a different form to load in the bottom of 
> the page, and process it as it does now. This would allow me also to 
> refresh sqlform.grid contents without a page reload too.
>
> So instead of five pages, I'd have one page, and five components, but only 
> one div for them to go in
>
> Does this sound like something possible? A reasonable way to construct an 
> app? The page reloads look kind of ugly at the moment.
>
> I'm struggling though with the examples,  could someone please give a 
> couple of pointers about how this might be accomplished?
>
> Thanks
>

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