[Seaside] How to stop periodical, end a polling mechanism... again

Leandro Pérez lperez at lifia.info.unlp.edu.ar
Thu Jul 5 15:06:20 UTC 2007


Hello
Sorry to bother you all again with the same stuff. I'm trying to change the
way i solve this kind of problem from the "hack" solution:

posted here:
http://www.nabble.com/Ajax-live-updates-tf1922480.html#a5263907
http://www.nabble.com/Displaying-progress-on-a-web-page-tf2115321.html#a5853986  
http://www.nabble.com/Never-ending-poll-when-rendering-periodical-tf4011797.html


to the solution Lukas proposed in:
http://www.nabble.com/Never-ending-poll-when-rendering-periodical-tf4011797.html
(second post, chronologically)
which is the one using #stop and #assignTo:

Consider this example:

renderContentOn: html
        html div id: 'time'.
        html submitButton
                onClick: (html periodical
                        id: 'time';
                        frequency: 1 second;
                        assignTo: 'periodical';
                        callback: [ :r | r render: (DateAndTime now - (start
ifNil: [ start
:= DateAndTime now ])) ]);
                text: 'Start'.
        html submitButton
                onClick: (html periodical
                        alias: 'periodical';
                        call: 'stop');
                text: 'Stop'
As espected, the periodical works and whenerver the second button is
clicked, it stops, everything is Ok. But now i need to stop the periodical
as a result of the evaluation of a condition in the callback of the
periodical, this is server side.
Basically the periodical must stop itself when a certain condition is
fulfilled. The problem is that such condition is checked server side and I
can't find the way to execute the necessary javascript code client side,
this would be something like this:


renderContentOn: html
        html div id: 'time'.
        html submitButton
                onClick: (html periodical
                        id: 'time';
                        frequency: 1 second;
                        assignTo: 'periodical';
                        callback: [ :r | aCondition ifTrue:[
                                                 (r periodical)
                                                       alias: 'periodical';
                                                       call: 'stop']]);
                text: 'Start'.

But This does not work

Any Ideas?

Thanks again
Leandro


-- 
View this message in context: http://www.nabble.com/How-to-stop-periodical%2C-end-a-polling-mechanism...-again-tf4030323.html#a11448336
Sent from the Squeak - Seaside mailing list archive at Nabble.com.



More information about the Seaside mailing list