[Seaside] How I delayed a Seaside callback to allow a JQuery toggle effect to happen before the callback.

Tim Murray tmurray at ecsorl.com
Wed Jul 28 15:13:44 UTC 2010


Posting this in the hope somebody finds it useful.

 

Problem outline: 

 

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.

 

Solution: 

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
slide"

            html div class: 'pack'; with: [

                        html div 

                                    class: 'box';

                                    class: 'white';    with: [

                                                            #(clip) do:
[ :each | 

 
html anchor

 
onClick: ((html jQuery: '.box') effect toggle; perform: each);

 
callback: aBlock;

 
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:[

                                    self

                                                renderBoxOn: html
withText: 'My Link Text'  withCallback: [(Delay forSeconds: 1) wait.self
show: someCustomComponent new];

                                                renderFormButtonsOn:
html.]]

 

 

A drawback of the above, is that the link is on the anchor text, not on
the box.

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...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20100728/56b6c447/attachment.htm


More information about the seaside mailing list