[Seaside] adding parameters to updater
Ron Teitelbaum
Ron at USMedRec.com
Tue Oct 24 21:47:53 UTC 2006
Hi all,
Any idea why this doesn't work? Maybe I do not understand updater. I'm
trying to make this as simple as possible so I can see what it is doing? It
seems like it is working but the javascript is not being evaluated once it
is returned to the browser. Is there a way to see what ajax is returning?
Any ideas what I'm doing wrong?
>>renderContentOn: html
html div id: 'ron';
onClick: (html evaluator callback: [ :script |
script element
id: 'ron';
addClassName: 'foo' ]);
with: [
html text: 'hello'
].
>>style
^
'#ron .foo {
background-color: red;
}
#ron {
background-color: green;
}
'
> -----Original Message-----
> From: seaside-bounces at lists.squeakfoundation.org [mailto:seaside-
> bounces at lists.squeakfoundation.org] On Behalf Of Lukas Renggli
> Sent: Monday, October 23, 2006 4:47 PM
> To: Ron at usmedrec.com; The Squeak Enterprise Aubergines Server - general
> discussion.
> Subject: Re: [Seaside] adding parameters to updater
>
> > 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
> bubbling.
>
> > 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"') ])
>
> 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
More information about the Seaside
mailing list