[Seaside] Seaside + Scriptaculous: Question on SUAjax onLoad, onComplete, etc.

Nik Lutz nik.lutz at gmail.com
Tue Jun 26 23:51:11 UTC 2007


Maybe I've done something similar some time ago: After a file-upload,
the file had to be processed, that took up to several minutes....

My Solution:
In the callback of the upload button i forked a new thread that
processed the file:

self threadRunning: true.
  self processFile.
self threadRunning: false.
]   forkAt: Processor userBackgroundPriority named: 'Monitor import'

Render some information (duration) while the import is running, during
this time poll to see if the thread has finished:

#renderProgressBarOn: html
	html div
		id: 'divProgressbar';
		with: [
			html text: #pleaseWaitTillImportHasFinished translate ] .
#renderValidationOn: html
	self renderProgressBarOn: html.
	html div
		script: (
                    html periodical
			evalScripts: true;
			frequency: 1;
			callback: [ :r |
				self isThreadRunning:
					ifFalse: [
						r script:'updater.stop();$('divProgressbar'').setStyle({display:
						super  renderValidationOn: r ]
					ifTrue: [
						r render: self elapsedTime duration ]];
			assignTo: 'updater');
		with: [ ].

so instead of hiding the progress-bar, you could do another full-request....

hope it helps


2007/6/26, Lukas Renggli <renggli at gmail.com>:
> > does anybody knows how to make this work or how to do it in a better way?
> Seaside only processes one request per session at a time. It makes a
> lot of code much simpler, as you don't have to worry about
> concurrency. In your case it blocks the event handlers however, until
> the main request has been processes.
> > I don´t really know if the way i'm trying to do this is right, so if anyone
> > has a better idea it will be great!
> In general it doesn't make much sense to shoot off new requests from
> AJAX events. Most web browsers don't allow one to have more than 2
> concurrent requests anyway. To keep the responsiveness AJAX events
> should only evaluate relatively fast JavaScript that doesn't do
> anything asynchronous.
> Lukas
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

More information about the Seaside mailing list