Finally got around to try it out - works like a charm, this makes component based design of applications really f**king awesome, excuse me French. I will force myself to write a slice about that soon. This should also go into the official documentation since this IS A KEY feature of web2py for developing component based application GUIs (not just dynamic web pages). As a further note it should be stated that the above is just the basic example, together with two small functions the signal slot mechanism of qt can be imitated http://en.wikipedia.org/wiki/Signals_and_slots For that a global dictionary would hold all components and their target ids ... you might get the idea :)
On Jan 28, 4:26 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > Yes. I have not tried it but something like this: > > #IN default.py > def index(): return dict() > def a_form(): > if request.env.request_method=='POST': > response.headers['web2py-component-command'] = \ > 'web2py_ajax_page("GET","%s","","a_list")' \ > % URL(r=request,f='a_list') > return crud.create(db.table) > def a_list(): > return SQLTABLE(db(db.table.id>0).select()) > > #IN views/default/index.html > {{extend 'layout.html'}} > <div id="my_form">loading form ...</div> > {{=LOAD('default','a_form',ajax=True,target="my_form")}} > <div id="my_list">loading list ...</div> > {{=LOAD('default','a_list',ajax=True,target="my_list")}} > > The {{=LOAD(..)}} embeds the components (a_list, a_form) via ajax and > capture the response so that only components get updated on > submission). The code: > > if request.env.request_method=='POST': > response.headers['web2py-component-command'] = \ > 'web2py_ajax_page("GET","%s","","a_list")' \ > % URL(r=request,f='a_list') > > returns instructions to the page when a form is submitted. It tells > the form to trigger an ajax call to the a_list component. > > You may need to debug this a little. > > On Jan 28, 6:07 am, selecta <gr...@delarue-berlin.de> wrote: > > > > > Does anybody have some experiences with creating dynamic content with > > jquery? > > I know the signal/slot system from qt and I have the feeling that > > trigger/bind from jquery can do the same thing in web2py > > > My idea is to have e.g. a list view (controller list) and a form > > (controller form). Both are loaded via ajax onto the same page, when > > the form is submitted (via ajax) and it has the right content the > > controller form will return the trigger that updates the list view > > (calls controller list). > > Is this possible? Am I thinking in the right direction? > > > Please help or guide me into the right direction. > > > If I am to unclear please tell me and I will try to find a better > > example -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.