[Seaside] [Q] Conditional Updating Using Scriptaculous

Lukas Renggli renggli at gmail.com
Sat Jan 12 09:24:18 UTC 2008

> To update element with id 'id', I can use html updater id:'id'; ... in scriptaculous.
> But there're times that updating is not needed conditionally. For example,
> div element "itemList" does have 1000+ sub element in itself and a link
> for updating 'itemList' is clicked, but there's no new element added so updating
> should not be done. (Doing update does not harm, but it takes 10+ seconds).
> How can I do this, "updater with condition"?

As you say, you use a condition.

html updater
     id: 'somewhere';
     callback: [ :r | ... ];
     condition: ((html element
         id: 'id';
         childElements) size
             addDecoration: (SUBinary new operator: '<='; statement: 1000))

For the last line you maybe want to add some conveniance method to
SUObject, this looks a bit ulgy right now.

Generally for complicated JavaScript behavior it makes sense to write
the script in an editor and include it as an external file.


Lukas Renggli

More information about the seaside mailing list