[Seaside] Re: show spinner until something is done

Sabine Manaa manaa.sabine at gmail.com
Tue Jul 26 13:04:33 UTC 2016


Hi Maarten,

I am just experimenting with it and it seems to work in my small example.
You brought my thoughts in a new direction - thanks a lot for it!

I started with adding it as html script: '' and will change it to smalltalk
code later.
I replaced the check for a dom element in the example with the check if the
file on the server exists.

Regards
Sabine

2016-07-25 22:12 GMT+02:00 Maarten Mostert-2 [via Smalltalk] <
ml-node+s1294792n4907892h47 at n4.nabble.com>:

> Hello Sabina,
>
> Don’t know how you do javascript and JQuery in Seaside (I use Appex) but
> can’t you build something like this:
>
>
> http://stackoverflow.com/questions/5525071/how-to-wait-until-an-element-exists
>
> Maarten,
>
>
>
> On 25 Jul 2016, at 11:52, Sabine Manaa <[hidden email]
> <http:///user/SendEmail.jtp?type=node&node=4907892&i=0>> wrote:
>
> I create pdf reports which are converted to pngs for small previews (and
> print/mail/export).
>
> When the user clicks at "report", there are several pdf reports and their
> pngs generated in the background.
> In this moment (When the user clicks at "report"), the application changes
> to the reports page.
> But in this moment, the repots possibly are not yet finished :-)
>
> So, I want to  show a spinner/counter for each of the reports and update
> each in the moment when the png is ready.
>
> I succeeded with all but the spinner/counter and the moment when the page
> renders. Its to late.
>
> My problem is that the page is rendered only in the moment, when the code
> is
> run. Not earlier.
> I assume the onLoad is to late? I tried several things for several hours
> :-(
> and now I want to ask the community.
>
> I reduced the problem to a very simple example: 2 methods with the
> question:
> how to change this code to update the counter 1,2,3,4...
> Very curious about a solution
>
>
> renderContentOn: html
>
> html div
> id: 'image';
> with: [ html text: 'Waiting for the report' ].
> html div
> id: 'counter';
> with: [ html text: 'This should count 1,2,3...' ].
> html document addLoadScript: (html jQuery ajax script: [ :script | self
> loadScriptIndex: 1 script: script ])
>
> loadScriptIndex: anIndex script: s
>
> | theIndex |
> (Delay forMilliseconds: 100) wait.
> theIndex := anIndex.
> "aPngFilename asFileReference exists" anIndex > 50 "simulate file is there
> after some time"
> ifTrue: [
> s << (s jQuery: #image)
> replaceWith: [ :h |
> h text: theIndex asString.
> h image
> altText: 'Report';
> width: '100%';
> url: 'http://localhost/reports/a.png' ] ]
> ifFalse: [ theIndex := theIndex + 1.
> s << (s jQuery: #counter)
> replaceWith: [ :h |
> h div
> id: #counter;
> with: [ h text: theIndex asString ] ].
> self
> loadScriptIndex: theIndex
> script: s
>
>
> and possibly
> registerTestApplication
> | theApplication |
> theApplication := WAAdmin register: RKATestView asApplicationAt: 'RKT'.
> theApplication
> addLibrary: JQDeploymentLibrary;
> addLibrary: JQUiDeploymentLibrary.
> ^ theApplication
>
>
>
>
>
> --
> View this message in context:
> http://forum.world.st/show-spinner-until-something-is-done-tp4907725.html
> Sent from the Seaside General mailing list archive at Nabble.com.
> _______________________________________________
> seaside mailing list
> [hidden email] <http:///user/SendEmail.jtp?type=node&node=4907892&i=1>
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
>
> _______________________________________________
> seaside mailing list
> [hidden email] <http:///user/SendEmail.jtp?type=node&node=4907892&i=2>
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://forum.world.st/show-spinner-until-something-is-done-tp4907725p4907892.html
> To start a new topic under Seaside General, email
> ml-node+s1294792n86180h75 at n4.nabble.com
> To unsubscribe from show spinner until something is done, click here
> <http://forum.world.st/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4907725&code=bWFuYWEuc2FiaW5lQGdtYWlsLmNvbXw0OTA3NzI1fC0xOTE3OTcxOTg5>
> .
> NAML
> <http://forum.world.st/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://forum.world.st/show-spinner-until-something-is-done-tp4907725p4908028.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/20160726/bdfb0c47/attachment-0001.htm


More information about the seaside mailing list