[Seaside] immediate display alert to user while Ajax request
pdebruic at gmail.com
Fri Jul 21 15:50:17 UTC 2017
You might want fork the report processing using a ThreadPool e.g.
is here: http://smalltalkhub.com/#!/~pdebruic/ThreadPool
And then in your 'update the message to the customer polling' code also poll
for the reports to be complete and have that code update the page once they
The ThreadPool, when running, does use some CPU, maybe more than it should,
and I haven't looked into why yet.
Hope this helps.
Sabine Manaa wrote
> 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
> empty string.
> *In my main view I have >>renderLoadIntervalMessageOn: html
> html paragraph
> id: 'spf-direct-message';
> (html jQuery this load
> 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
> individual messages by setting the string in the session.
> BUT: while I am in the Ajax block, it does not work.
> 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-tp4956083p4956118.html
Sent from the Seaside General mailing list archive at Nabble.com.
More information about the seaside