[Seaside] How I delayed a Seaside callback to allow a JQuery toggle
effect to happen before the callback.
tmurray at ecsorl.com
Wed Jul 28 15:13:44 UTC 2010
Posting this in the hope somebody finds it useful.
Using the seaside Dispatcher->tests->jquery-ui->Effects->Toggle demo, I
wanted to make the box an anchor that invoked a Seaside callback . The
idea being the box would "bind, clip, drop explode, fold puff scale
slide...whatever" and then the new component would appear.
However, the speed of the seaside callback out-paced the Toggle effect.
Here is the modified JQUI example "wrapper" for the effect.
renderBoxOn: html withText:aString withCallback:aBlock
"available toggle effects are: blind clip drop explode fold puff scale
html div class: 'pack'; with: [
class: 'white'; with: [
[ :each |
onClick: ((html jQuery: '.box') effect toggle; perform: each);
with: aString asString]
The solution to the problem lies in ....the callback: aBlock;
I added a (Delay forSeconds: 1) wait. To the beginning of the block.
This slows down seaside enough for the JQuery effect to happen.
html div class: 'main'; with: [
html form with:[
withText: 'My Link Text' withCallback: [(Delay forSeconds: 1) wait.self
show: someCustomComponent new];
A drawback of the above, is that the link is on the anchor text, not on
I will be focusing on that moving forward.
Anyway, the (Delay forSeconds: 1) wait is the point of this post.
Hope it helps somebody.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the seaside