[Seaside] Showing and hiding an overlay during an ajax call

Dave lasmiste at gmail.com
Mon Jul 10 16:45:27 UTC 2017


Hi guys,

I want to show and dismiss an overlay
(https://gasparesganga.com/labs/jquery-loading-overlay/) during an quite
long processing that starts from an ajax call.
Showing the overlay is not an issue, but I can't dismiss it.


My code is:


html document addLoadScript: (JSStream on: '$.LoadingOverlay("show");').

html jQuery ajax
		callback: [ ... ] value: (JSStream on: '...');
		onSuccess:
			((html jQuery id: 'myId') load
				html: [ :h | self veryLongOperationOn: h ]).
				
				
Now I don't know where to put the code to hide the overlay. If I write:

html jQuery ajax
		callback: [ ... ] value: (JSStream on: '...');
		onSuccess:
			((html jQuery id: 'myId') load
				html: [ :h | self veryLongOperationOn: h ]);
		*onComplete: (html document addLoadScript: (JSStream on:
'$.LoadingOverlay("hide");'))*
		
The overlay immediately disappears because the onComplete does not wait for
the veryLongOperation. So I think I should put the code in the block like:

html jQuery ajax
		callback: [ ... ] value: (JSStream on: '...');
		onSuccess:
			((html jQuery id: 'myId') load
				html: [ :h | self veryLongOperationOn: h.				
				*h document addLoadScript: (JSStream on: '$.LoadingOverlay("hide");')*
])

but of course it does not work.

Can you help me please?
TIA
Dave



--
View this message in context: http://forum.world.st/Showing-and-hiding-an-overlay-during-an-ajax-call-tp4954136.html
Sent from the Seaside General mailing list archive at Nabble.com.


More information about the seaside mailing list