[Seaside] updating the contents of a div as a side effect ofaliveCallback..

Ramon Leon ramon.leon at allresnet.com
Wed Jan 31 22:18:46 UTC 2007

> 1) #rendererClass currently returns ^Seaside.WAAsyncRenderCanvas
>     but I gather it should be WARenderCanvas for Scriptaculous?

Yup, and in current version, this is already the default, so you don't have
to do anything.

> 2) Base component should be WAComponent instead of the Async version
>     (WAAsyncComponent)


> 3) Change instances of html blah ... liveCallback: [] to 
> something using
>     onClick:[] instead?  I gather I need to specify a "control & model
>     for each item -- not sure what those do exactly yet..
> Did I miss anything? If I did switch now it would be fairly 
> trivial assuming the Scriptaculous stuff has something like 
> the liveCallbacks.

Scriptaculous should be able to easily do anything liveCallbacks are doing
and then some.

> So, IF I switched, how *could* I update a div within the 
> current page when a particular event is triggered?
> Thanks!

Here's the pattern...

html anyElement
    onClick: (html updater id: #divYouWantToUpdate; 
        callback:[:ajax | self renderDivYouWantToUpdateAgainOn: ajax ]);
with: 'Bla Bla'

This is why it's important to factor the code well.  Ideally, any part of
the page you want to ajax update, has it's own rendering method, so you can
call it normally on the server side for the first page render, and then pass
the ajax canvas through the same method to live update that part of the page
whenever you like on whatever javascript event you like.

Ramon Leon

More information about the Seaside mailing list