[Seaside] hand-written javascript in Ajax
Chris Dawson
xrdawson at gmail.com
Thu Jun 5 08:47:15 UTC 2008
I'm almost there.
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.
Chris
On Wed, Jun 4, 2008 at 11:24 PM, Lukas Renggli <renggli at gmail.com> wrote:
> > When the user
> > clicks on the link it makes an Ajax call and adds to a collection on the
> > server.
>
> Ok, if you don't want to update then simply use the AJAX requestor:
>
> (html request callback: [ coll add: 123 ])
> asJavascript
>
> This expression gives you a string that when evaluated by the
> Javascript engine triggers the execution of the Smalltalk block on the
> server.
>
> If you need to pass some data from the JavaScript world to the server
> you can use something like that:
>
> (html request
> callback: [ :v | coll add: v ]
> value: (SUStream on: 'navigator.appName'))
> asJavascript
>
> In this case the property navigator.appName is passed to the server.
> As far as I understand you want to pass some Google Maps data there.
>
> > I tried to use the code you provided in one method and I get:
> >
> > MessageNotUnderstood: SUScript>>render:
>
> I write most of the examples for the mailing-list directly in the
> mail-application, therefore there is usually some significant amount
> of fixing needed before usage. I only try to clear what the general
> approach is.
>
> For the example in the previous mail: Remove #asJavascript, the thing
> is already a string. SUScript in my Seaside 2.8 images understands
> #render:.
>
> > tried using #render:on: and didn't get much better results. Am I using
> an
> > out of date Scriptaculous package?
>
> I don't know what platform and version you are on.
>
> 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/1cc99b68/attachment.htm
More information about the seaside
mailing list