[Seaside] [Scriptaculous] - Combining #onClick: on a tag
cbeler at enit.fr
Fri Oct 13 13:06:38 UTC 2006
> ... onClick: 'alert("1");alert("2")'
> you get one message box after the other, not all at once ;-)
> Now, it might depend what you actually do within your statements. In
> the context of [Scriptaculous] you probably mean something like ...
> ... onClick: (html update id: 'id1'; callback: [ ... ]) , (html
> update id: 'id2'; callback: [ ... ])
actually, I was doing:
onClick: (html update id: 'id1'; callback: [ ... ]);
onClick: (html update id: 'id2'; callback: [ ... ]);
I like better to concatenate the SUStreams...
What I'm triing to do is (in this case):
- I have a tree that allows to select categories.
- I have a list of instances, and this list is updated according to the
When I click on the label of the tree node, both the node is updated and
the list. What is strange is that it is working sometimes and sometimes
not (I have to click a second time on the label so as to update the
**actually I just solved the problem...** I had to specify self
selected: aNode in the 2nd callbacks...
SUTree>>renderNodeLabel: aNode on: html
class: 'label' ;
with: [(self canSelect: aNode)
ifTrue: [ html span
class: ((self selected == aNode) ifTrue:
with: [html anchor
evalScripts: true; "not sure
callback: [:rend | self
selected: aNode . self renderTreeOn: rend ]),
callback: [:rend | ****self
selected: aNode*****. "I added self selected: aNode here whereas I
first thought it will be done because of the first callback"
selectBlock value: aNode.
text: self labelOf: aNode]]
ifFalse: [html render: self labelOf: aNode]]
> The updaters for id1 and id2 immediately return as the updater itself
> is run asynchronously (the first A in AJAX). If you want you can
> change that with some setting in SUAjax. The same is true for
After some more experiments, I have another solution... with
asynchronous: false; "so it's synchronous (?), and
then the callback is evaluated in first place. Am I right ?"
then I can remove the duplicated *self selected: aNode*
More information about the Seaside