[Seaside] Re: SUPeriodical - changing the frequency on the fly
Frank Sukhu
fsukhu at gmail.com
Sat Aug 19 02:25:12 UTC 2006
Here is the code that I am using:
--- start of code ---
renderContentOn: html
"periodical and counter are instance vars"
periodical isNil ifTrue: [
"lazy initialization of periodical"
periodical := html periodical. periodical frequency: 10].
html paragraph
script: (periodical
on: #renderNextImageOn: of: self).
renderNextImageOn: html
"the first 5 times the frequency will be equal to 10 seconds after
that the frequency will be set to 30 seconds"
self counter > 5 ifTrue: [periodical frequency: 30]
ifFalse: [ counter := counter + 1].
html div id: 'FSTest'; with: [
html image
id: 'logo';
height: 300;
width: 400;
url: ('http://localhost/resources/aSampleImage.jpg');
altText: 'testImage'].
--- end of code ---
I think that I am starting to see why this will not work and I am begining
to understand what you said. I suspect that SUPeriodical will only render
the paragraph containing the "script". Because the whole html page is not
re-written, the javascript code in the page is not updated with the new
frequency. Is this correct?
... Frank
"Ramon Leon" <ramon.leon at allresnet.com> wrote in message
news:011b01c6c326$1d0cceb0$9700a8c0 at hq.allresnet.com...
> > Hello,
> >
> > I am trying to change the frequency of aSUPeriodical on the
> > fly but what I am doing does not work. I create an instance
> > of SUPeriodical with a frequency of 10 seconds. That works
> > fine, the SUPeriodical is triggered every 10 seconds. I then
> > change the frequence of the same instance of SUPeriodical to
> > 30 seconds but it continues being triggered every 10 seconds.
> >
> > I have examined the SUPeriodical instance and confirmed that
> > its frequency has been changed to 30.
> >
> > Am I doing something wrong?
> >
> > Thanks,
> > Frank
> >
>
> Umm... I'm not sure you can do this. First off, as far as I know, these
are
> transient objects, used to generate JavaScript and then disposed of during
> the rendering phase. Holding onto an instance and editing it will likely
do
> nothing as the client side JavaScript has already been generated. Can you
> show your code to confirm?
More information about the Seaside
mailing list