[Seaside] show spinner until something is done
Maarten Mostert
maarten.mostert at wanadoo.fr
Mon Jul 25 20:56:27 UTC 2016
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 <http://stackoverflow.com/questions/5525071/how-to-wait-until-an-element-exists>
Maarten,
> On 25 Jul 2016, at 11:52, Sabine Manaa <manaa.sabine at gmail.com> 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
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20160725/6c616edd/attachment.htm
More information about the seaside
mailing list