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

Lukas Renggli renggli at gmail.com
Wed Jul 28 16:52:23 UTC 2010


Thanks for sharing.

Keep in mind that this might put quite some load onto the server, if
lots of clients cause their process to wait for one second.

What about using the #onComplete: event to trigger the callback after
the effect has completed?

Lukas


On 28 July 2010 17:13, Tim Murray <tmurray at ecsorl.com> wrote:
> 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.
>
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>



-- 
Lukas Renggli
www.lukas-renggli.ch


More information about the seaside mailing list