Hi Massimo,

Yea, setting ajax=True makes it work fine.  I haven't tested trunk
yet.

Sorry for being dense, but what is the use case for the .load version?

{{=LOAD(request.controller,'p_view_list')}} renders the full view.
{{=LOAD(request.controller,'p_view_list.load')}} just returns the raw
data... at least in my example.

Why would I use one and not the other?

On Jul 21, 12:56 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
> Anyway... even with the bug it should work if you set ajax=True which
> is the most typical use case.
>
> On Jul 21, 1:52 am, Rob <r...@rmdashr.com> wrote:
>
> > views/item/index.html:
> > {{extend 'layout.html'}}
> > <h1>This is the item/index.html template</h1>
> > {{=LOAD(request.controller,'p_view_list.load')}}
>
> > views/p_view_list.html:
> > {{extend 'layout.html'}}
> > <form enctype="multipart/form-data" action="" method="post">
> > ...
> > </form>
>
> > controllers/item.py:
> > def p_view_list():
> >     for k,v in request.vars.items():
> >         if k.startswith('need_'):
> >             id = k.split('_')[-1]
> >             item = db(db.Item.id == int(id)).select()[0]
> >             item.update_record(need=('on' in v))
> >         response.flash = "Saved"
> >     items = db(db.Item.category==db.Category.id).select(db.Item.ALL)
> >     #since this is ajax, this causes the response to get displayed
> >     if response.flash: response.headers['web2py-component-
> > flash']=response.flash
> >     return dict(items=items)
>
> >http://127.0.0.1:8000/list/item/p_view_list.load-works fine - I see
> > the form.  .json also works.http://127.0.0.1:8000/list/item/index-broken - 
> > It displays "invalid
> > function"
>
> > Any ideas why it displays 'invalid function'?
>
> > Also, If I change the LOAD statement to:
> > {{=LOAD(request.controller,'p_view_list')}} (and remove the 'extend
> > layout.html' line) it loads fine.
>
> > I asked this before, but what is the difference between the two?
>
>

Reply via email to