[Seaside] adding parameters to updater

Lukas Renggli renggli at gmail.com
Mon Oct 23 20:46:31 UTC 2006

> Is there a way to update the attributes of the tag that is called in the
> SUUpdater?

No, you can only update the contents of the tag identified with the
#id: as a whole.

> I thought that insertion might be it (see below), I also saw

#insertion: goes together with instances of SUInsertion. It is used to
add a new element into the DOM tree, either before/after the element
or within at the top/bottom the element identified with #id:.

This is always the #callback: block used to render the element.

> SUEvent>>element but could not figure out how to get to SUEvent from
> updater?

This is the current JavaScript event within the Web-browser. It
provides the coordinates of the mouse-pointer, keyboard state, etc. It
is also possible to use SUEvent to cancel the event and stop it from

>             onClick: (html updater id: 'myID';
>                         insertion: 'background-color: ''blue'';';
> callback: [:rend | self renderContentsOn: rend]);

You can basically do what you want using the evaluator by injecting
JavaScript code into the page (untested):

    onClick: (html evaluator callback: [ :script |
       script element
          id: 'myId';
          addClassNamed: 'foo' ])

when you have a style-sheet with the class foo

    .foo { background-color: blue }

Since you can inject any kind of JavaScript using #evaluator you could
also try to do it directly with something like by not using what
Scriptaculous provides (untested as well):

    onClick: (html evaluator callback: [ :script |
       script add: (SUStream on: '$("myId").style.backgroundColor = "blue"') ])


Lukas Renggli

More information about the Seaside mailing list