[Seaside] Scriptalicious

Ramon Leon ramon.leon at allresnet.com
Mon Jul 31 19:55:20 UTC 2006


> > Hi, anyone know a way to update multiple elements on a page with a 
> > single ajax callback?
> 
> Yes, this is possible, but the approach is slightly 
> different. I am on holidays right now and have no computer 
> with a Squeak image ready but something like the following 
> code should work. If you can`t make it run within a week, I 
> will be able to provide a tested example ...
> 
> html anchor
>    onClick: (html evaluator
>       callback: [ :script |
>          script add: (script element id: 'id1'; update: 'bla bla').
>          script add: (script effect id: 'id1'; appear).
>          script add: (script element id: 'id2'; update: 'bla 
> bla bla').
>       ]
> 
> Basically the idea is to inject a script into the existing 
> web-site with the evaluator. I think in the latest version of 
> scriptaculous there is an example with an Accordeon Component 
> that does exactly this, but I am not entirely sure.
> 
> Cheers,
> Lukas
> 
> --
> Lukas Renggli
> http://www.lukas-renggli.ch

Hmm... this almost works.  It does update multiple elements, but it's a bit
too simple to do what I need.  Here's kind of what I'm trying to do, syntax
just made up for second add...

html script: (html evaluator
    callback: [ :script |
        script add: (script element id: 'id1'; update: 'price here').
        script add: (script element id: 'id2'; 
            render: [:r | 
                self allPrices do:[:each | 
                    r text: each. 
                    r anchor callback:[self bookRate: each]; text: 'book
rate']])])

Ok, updating the first element, simple text content, works great, but
updating the second element, need to insert multiple child elements with
anchors and callbacks, need a rendering context, can't figure this one out.
Any ideas?







More information about the Seaside mailing list