[Seaside] SU: Periodical evaluation

Udo Schneider Udo.Schneider at homeaddress.de
Thu Sep 13 19:18:53 UTC 2007


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



More information about the seaside mailing list