[Seaside] Stopping SeasideAsync refreshes?

ragnar at ragnar-hojland.com ragnar at ragnar-hojland.com
Tue Jan 16 02:18:29 UTC 2007


I'm trying to process a file and display some messages as it is
processed. The skeleton I have below works fine.

My issue is how to stop the refreshes once the processing is done (for
example, once messages has the string 'Done'). I tried moving the 
processing and messages onto an embedded subcomponent, calling it and
answering from it when it was done, but the page kept refreshing.

What should I be doing?



initialize
  messages _ Dictionary new.
  messages at: #text put: 'Stopped'.



renderContentOn: html
  html form multipart; with: [
  html fileUpload callback: [:f |
     [self insertFile: f ] forkNamed: 'insertProcess'.
     html div id: 'insertMessages';
        refreshWith: [ :ev :h | h render: (messages at: #text) ]
        every: 2 seconds ].

     html submitButton text: 'Insert File'.

     html div id: 'insertMessages';
        with: [ html render: (messages at:  #text) ]
  ]



insertFile: aFile
  (1 to: 5) do: [ :i |
     messages at: #text put: ('Line ', i asString).
     (Delay forSeconds: 1) wait ].

  messages at: #text put: 'Done'



rendererClass
  ^ WAAsyncRenderCanvas




More information about the Seaside mailing list