jQuery component rendering by interval

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

jQuery component rendering by interval

Bob Nemec
Hello,
I am not able to get what would seem to be simple jQuery refresh working. 
The code is supposed to render a component every five seconds. 
I can see the render code being triggered, but the browser display is not being updated.

My code looks something like this... 

html script: (
(html jQuery ajax script: [:s | 
s << (s jQuery html: [:r | r render: self selectedComponent])]
) interval: 5 seconds)

...I do a similar thing in another application using Scriptaculous, which works fine... 

html div 
script: (
html scriptaculous updater
interval: 5 seconds;
on: #renderSelectedComponentOn: 
of: self);
with: [ self renderSelectedComponentOn: html ]

I've been searching through the archives, but all the hits I find make me think the jQuery code is OK.
I imagine I'm missing something obvious... so thanks for any help.

Bob Nemec






_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Bob Nemec
Reply | Threaded
Open this post in threaded view
|

Re: jQuery component rendering by interval

jtuchel
hi bob,

I guess you should add to the script a jquery expression that causes some component to be replaced with the contents of the rendering. So either this part is missing in your snippet or it`s really missing. The ajax call is made to re server, but you dont use the results.

Look at senders of load or replace....

Joachim

[hidden email] schrieb:

Hello,
I am not able to get what would seem to be simple jQuery refresh working. 
The code is supposed to render a component every five seconds. 
I can see the render code being triggered, but the browser display is not being updated.

My code looks something like this... 

html script: (
(html jQuery ajax script: [:s | 
s << (s jQuery html: [:r | r render: self selectedComponent])]
) interval: 5 seconds)

...I do a similar thing in another application using Scriptaculous, which works fine... 

html div 
script: (
html scriptaculous updater
interval: 5 seconds;
on: #renderSelectedComponentOn: 
of: self);
with: [ self renderSelectedComponentOn: html ]

I've been searching through the archives, but all the hits I find make me think the jQuery code is OK.
I imagine I'm missing something obvious... so thanks for any help.

Bob Nemec






_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: jQuery component rendering by interval

Robert Sirois
I'm with Joachim. Try something like this:

renderContentOn: html

html script: (
(html jQuery ajax script: [:s | 
s add: ((s jQuery: 'body') load html: [:r | r render: self content ])]
) interval: 5 seconds)

where content is a renderable (ie. a WAComponent ).

RS


Date: Thu, 15 Nov 2012 05:31:32 +0100
Subject: Re: [Seaside] jQuery component rendering by interval
From: [hidden email]
To: [hidden email]; [hidden email]

hi bob,

I guess you should add to the script a jquery expression that causes some component to be replaced with the contents of the rendering. So either this part is missing in your snippet or it`s really missing. The ajax call is made to re server, but you dont use the results.

Look at senders of load or replace....

Joachim

[hidden email] schrieb:

Hello,
I am not able to get what would seem to be simple jQuery refresh working. 
The code is supposed to render a component every five seconds. 
I can see the render code being triggered, but the browser display is not being updated.

My code looks something like this... 

html script: (
(html jQuery ajax script: [:s | 
s << (s jQuery html: [:r | r render: self selectedComponent])]
) interval: 5 seconds)

...I do a similar thing in another application using Scriptaculous, which works fine... 

html div 
script: (
html scriptaculous updater
interval: 5 seconds;
on: #renderSelectedComponentOn: 
of: self);
with: [ self renderSelectedComponentOn: html ]

I've been searching through the archives, but all the hits I find make me think the jQuery code is OK.
I imagine I'm missing something obvious... so thanks for any help.

Bob Nemec






_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: jQuery component rendering by interval

Bob Nemec
Thank you... seems simple in hindsight ;-)
What I ended up with is...

html div id: 'refreshedComponent'; with: [
self renderSelectedComponentOn: html]

...and...

 self autoRefresh ifTrue: [
html script: (
(html jQuery id: 'refreshedComponent') load html: [:r | 
self refreshDomainData.
self renderSelectedComponentOn: r]; interval: 5 seconds)]

...where #autoRefresh is a Boolean that the user toggles with an "html checkbox onChange: 'submit()'; ... "

Works great. 

Bob


From: Robert Sirois <[hidden email]>
To: [hidden email]
Sent: Thursday, November 15, 2012 1:35:17 AM
Subject: RE: [Seaside] jQuery component rendering by interval

I'm with Joachim. Try something like this:

renderContentOn: html

html script: (
(html jQuery ajax script: [:s | 
s add: ((s jQuery: 'body') load html: [:r | r render: self content ])]
) interval: 5 seconds)

where content is a renderable (ie. a WAComponent ).

RS


Date: Thu, 15 Nov 2012 05:31:32 +0100
Subject: Re: [Seaside] jQuery component rendering by interval
From: [hidden email]
To: [hidden email]; [hidden email]

hi bob,

I guess you should add to the script a jquery expression that causes some component to be replaced with the contents of the rendering. So either this part is missing in your snippet or it`s really missing. The ajax call is made to re server, but you dont use the results.

Look at senders of load or replace....

Joachim

[hidden email] schrieb:

Hello,
I am not able to get what would seem to be simple jQuery refresh working. 
The code is supposed to render a component every five seconds. 
I can see the render code being triggered, but the browser display is not being updated.

My code looks something like this... 

html script: (
(html jQuery ajax script: [:s | 
s << (s jQuery html: [:r | r render: self selectedComponent])]
) interval: 5 seconds)

...I do a similar thing in another application using Scriptaculous, which works fine... 

html div 
script: (
html scriptaculous updater
interval: 5 seconds;
on: #renderSelectedComponentOn: 
of: self);
with: [ self renderSelectedComponentOn: html ]

I've been searching through the archives, but all the hits I find make me think the jQuery code is OK.
I imagine I'm missing something obvious... so thanks for any help.

Bob Nemec






_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Bob Nemec