[Seaside] immediate display alert to user while Ajax request

Sabine Manaa manaa.sabine at gmail.com
Fri Jul 21 15:31:05 UTC 2017

Hi Joachim, all,

thanks a lot! I think I am very near to the solution but there is one
problem remaining: within the Ajax block, the JQLoad   seems to be
"blocked". I explain:

* I have an attribute @directUserMessage: in my session initialized with an
empty string.

*In my main view I have >>renderLoadIntervalMessageOn: html
html paragraph
id: 'spf-direct-message';
(html jQuery this load
(' javascript which shows the snackbar if spa-direct-message is set'));
html: [ :r | self renderMessageOn: r ];
interval: 1 seconds);
with: [ self renderMessageOn: html ]

 >>renderMessageOn: html
self session directUserMessage isEmpty
ifFalse: [ html render: self session directUserMessage ]

I have my button invoking the report generation:

(html jQuery ajax
script: [ :script |
self session generateReportFiles: script.
with: 'PDF'.

in >>generateReportFiles:
"i set the directUserMessages:"
self session directUserMessage: 'Erstelle Reisekostenabrechnungen, bitte
RKAPDFWriter new createCostReports: self.
self session directUserMessage: 'Erstelle Belege, bitte warten...'.
RKAPDFWriter new createReceiptReports: self.
self session directUserMessage: 'Erstelle Fahrten, bitte warten...'.
RKAPDFWriter new createVehicleReports: self.
self session directUserMessage: 'Erstelle Buchungen, bitte warten...'.
RKAPDFWriter new createBookingReports: self.
self session directUserMessage: ''

I tried I with a test button:
html mdlButton
 (html jQuery ajax script: [ :script | self session directUserMessage:
'test' ]);
with: 'set message'

this works perfect - after clicking on the test button, the snackbar is
showing every second again.
So, I can say that the principle was clear and I have a possibility to show
individual messages by setting the string in the session.

BUT: while I am in the Ajax block, it does not work.
I put a console.log() into the javascript code and AFTER finishing the
Ajax, all the messages are put there.
It seems to wait till the Ajax call is finished.

I have put an output  into the transcript:

renderMessageOn: html
Transcript crShow: Time now printString , '-' , self session

and there I see, that while I am in the Ajax block, there is no output.
While I am not in the Ajax block, it renders the time into it each second.

What is wrong here, can anyone explain?
Joachim, do you also set the instance variable with the text from an Ajax


View this message in context: http://forum.world.st/immediate-display-alert-to-user-while-Ajax-request-tp4956083p4956113.html
Sent from the Seaside General mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/seaside/attachments/20170721/78c0724f/attachment-0001.html>

More information about the seaside mailing list