[Seaside] hand-written javascript in Ajax
Chris Dawson
xrdawson at gmail.com
Thu Jun 5 15:40:56 UTC 2008
Lukas,
Thank you. I got it working. I will definitely read further in the
documentation.
Ah, coding in Seaside is like going from painting with blocks of wood to
creating a Mona Lisa. Seaside code is pure art.
Chris
On Thu, Jun 5, 2008 at 2:05 AM, Lukas Renggli <renggli at gmail.com> wrote:
> > I have a marker on the map which houses a link with an onclick handler
> > called 'addLocation( "123456" );'. So, I tried to define addLocation
> like
> > this:
> >
> > html script: (' function addLocation( theId ) { ', ((
> > html updater
> > id: 'locations';
> > callback: [ :v |
> > locations add: ( myLocation new title: v ).
> > self renderLocationsOn: html.
> > ]
> > value: (SUStream on: 'theId')) asJavascript ), ';
> }'
> > ).
> > ]
> > ]
> >
> > This crashes my updater. It does pass the value of theId properly as
> this
> > is stored into the MyLocation collection. But, it seems I need an html
> > object renderer passed back to me.
>
> You should not render within #callback:value:. Use a
> rendering-callback to update your page.
>
> Furthermore, pay attention that 'html' is not valid anymore (this html
> stream has been sent out when the script was generated) when the
> callback is triggered. Use the renderer that gets passed into the
> render-callback. Slime detects that kind of problems.
>
> html updater
> id: 'locations';
> callback: [ :v | locations add: v ] value: 'something';
> callback: [ :r | self renderLocationsOn: r ].
>
> Please check out the class comments in SUAjax and subclasses. Also the
> methods #callback:value: and #callback: are heavily documented.
>
> Cheers,
> Lukas
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20080605/38227009/attachment.htm
More information about the seaside
mailing list