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

Louis LaBrunda Lou at Keystone-Software.com
Wed Jul 28 20:29:51 UTC 2010


On Wed, 28 Jul 2010 18:52:23 +0200, Lukas Renggli <renggli at gmail.com>
wrote:

>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.

I could be way off base here but wouldn't each client connection be in it's
own fork and therefor a delay in that fork wouldn't effect any other
connection?

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

Of course, using the #onComplete: event might be a better idea anyway.

Lou


>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
>>
>>
-----------------------------------------------------------
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:Lou at Keystone-Software.com http://www.Keystone-Software.com



More information about the seaside mailing list