Hello,
I'm still trying to find my way through Seaside&script.aculo.us and now have something where I think it should work but I have no idea how to do it. The basic task is to update multiple things in a website. I achieved this with the following code: initialize times := (1 to: 10) collect: [:each | Time now addSeconds: each * 5]. ^ super initialize idFor: aTime ^ (times indexOf: aTime) displayString renderTime: time on: html html span id: (self idFor: time); with: [time < Time now ifTrue: [html text: 'Done'] ifFalse: [html text: 'toDo']. html space; render: time] renderContentOn: html html unorderedList with: [times do: [:each | html listItem with: [self renderTime: each on: html]]]. html anchor onClick: (html evaluator callback: [:script | times do: [:eachTime | script element id: (self idFor: eachTime); render: [:render | self renderTime: eachTime on: render]]]); with: 'Update' Using this code each time I click the link the elements are updated. However I do not want the user to refresh manually but to call the evaluator automatically. I succeeded in updating single elements with "updater every: 10 seconds" w/o problem. But I didn't find a way to have the evaluator called in a regular interval. Any hints? Thanks, Udo _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Tell the evaluator to execute every 10 seconds ;-)
html script: (html evaluator every: 10 seconds; ....) Lukas On 9/13/07, Udo Schneider <[hidden email]> wrote: > Hello, > > I'm still trying to find my way through Seaside&script.aculo.us and now > have something where I think it should work but I have no idea how to do it. > > The basic task is to update multiple things in a website. I achieved > this with the following code: > > initialize > times := (1 to: 10) > collect: [:each | Time now addSeconds: each * 5]. > ^ super initialize > > idFor: aTime > ^ (times indexOf: aTime) displayString > > renderTime: time on: html > html span > id: (self idFor: time); > > with: [time < Time now > ifTrue: [html text: 'Done'] > ifFalse: [html text: 'toDo']. > html space; render: time] > > renderContentOn: html > html unorderedList > with: [times > do: [:each | html listItem > with: [self renderTime: each on: html]]]. > html anchor > onClick: (html evaluator > callback: [:script | times > do: [:eachTime | script element > id: (self idFor: eachTime); > > render: [:render | self renderTime: eachTime on: render]]]); > with: 'Update' > > Using this code each time I click the link the elements are updated. > However I do not want the user to refresh manually but to call the > evaluator automatically. > > I succeeded in updating single elements with "updater every: 10 seconds" > w/o problem. But I didn't find a way to have the evaluator called in a > regular interval. > > Any hints? > > Thanks, > > Udo > > _______________________________________________ > Seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Lukas Renggli wrote:
> Tell the evaluator to execute every 10 seconds ;-) > > html script: (html evaluator > every: 10 seconds; > ....) > Is there an award for the stupidest question of the month? I'm sure I'd get it :-) I was 100% sure that I tried this w/o success. However when I just tried it again it worked just like a charm! Don't know why it didn't work before. Thanks for your help. CU, Udo _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |