[Seaside] SU: Periodical evaluation
renggli at gmail.com
Thu Sep 13 19:48:22 UTC 2007
Tell the evaluator to execute every 10 seconds ;-)
html script: (html evaluator
every: 10 seconds;
On 9/13/07, Udo Schneider <Udo.Schneider at homeaddress.de> wrote:
> 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:
> 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?
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
More information about the seaside