If you haven't read the sections on ajax (don't recall the chapter)
and components (ch 13), then you must read them first. Then,
experiment with something really trivial in order to get your feet
wet, like this:

#controller
def index():
  return dict()
def callback():
  return 'hello world'

#view
{{extend 'layout.html'}}
<div id='target'></div>
<a href='#' id='test' _onclick='ajax("{{=URL('callback'}}",
["test"],"target">click me</a>

Couldn't be simpler. (Caveat: I haven't tried the above code per se,
but it looks like it should work.)

Anyway, keep your chin up. At first, my web2py productivity suffered
when I started to ajax stuff. After wrapping my head around the ajax
way and components, productivity is back up again ... way up.

On Dec 27, 5:37 pm, "David J." <da...@styleflare.com> wrote:
> Hey Markus;
>
> I am questioning the same thing; I am also trying to dig up this
> information.
>
> maybe someone on this list has dealt with similar problems and wouldn't
> mind sharing?
>
> If I find something I will be sure to post.
>
> Thanks.
>
> On 12/27/10 10:54 AM, Markus Schmitz wrote:
>
> > Good afternoon everybody,
>
> > I am trying my hand at a web2py based application and as long as I
> > stay with the good old postback pattern, everything works brilliantly
> > and coding is very efficient. In this style I programmed in the new
> > application the account management, a database logging feature, a FAQ
> > section, a feedback section, some import and export functionality.
>
> > Also the core functionality (with BI like functionality) works ok in a
> > post back manner, but is reaching performance and usability limits. I
> > would like to "ajaxify" the application and could obviously do so with
> > a corresponding amount of javascript+jquery. But suddenly the
> > efficiency gains of web2py are evaporating. I am aware of the ajax and
> > load functions in web2py, but they somehow do not fit my needs. So I
> > get the feeling, I either do not understand the ajax concept of web2py
> > or I am designing my app wrongly.
>
> > Here is an example, what I would like to do (one of many examples):
>
> > - display some data retrieved in a structured table like manner (easy
> > to be done with web2py).
> > - By clicking on an entry a modal popup window shall open and display
> > the data to be edited
> > - After editing and pressing 'save' the modal window closes and the
> > original table updates.
>
> > All of this without a postback. The wiki plugin works with a modal
> > window (the widget builder), but the result is taken with copy and
> > paste to the wiki text instead of being inserted automatically. So it
> > does not help me much.
>
> > Another example would be:
>
> > - I have on a page a tree, a form to search/filter data and a chart.
> > - When a node in the tree is clicked, than the filter selection
> > changes and the chart needs to reload accordingly
> > - When a node in the chart is selected, then again the filter changes
> > and the tree needs to reload
> > - Naturally if the filter form changes, both tree and chart needs to
> > reload.
>
> > I implemented this with javascript events on the tree and chart and
> > old fashioned postback, but which ajax pattern would you suggest for
> > this? Naturally I would like to minimize the javascript hacking on the
> > page as much as possible.
>
> > I am not looking for concrete coding tips here, more for the general
> > patterns of how to do ajax with web2py with minimal effort.
>
> > Regards
>
> > Markus
>
>

Reply via email to