Rails & Ajax : Updating a list from the top

Hi!

I am newbie in AJAX, RJS just a beginer in Rails. Anyway, here is my
problem :
I am bulding an app that will display a list of messages. The last
messages appear at the top of the list. For now, it’s static, the list
is updated only if the user “refreshes” the web page… My goal is that
this list is updated without “refreshing” the whole page, with new
messages appearing at the top!

I am sure this is easy in rails, but, hey, as I said, I am beginer, so
please, guys (and gals!), if you know how to do this, please share with
me!

Thanks a lot for your help!

Julien Genestoux wrote:

Hi!

I am newbie in AJAX, RJS just a beginer in Rails. Anyway, here is my
problem :
I am bulding an app that will display a list of messages. The last
messages appear at the top of the list. For now, it’s static, the list
is updated only if the user “refreshes” the web page… My goal is that
this list is updated without “refreshing” the whole page, with new
messages appearing at the top!

I am sure this is easy in rails, but, hey, as I said, I am beginer, so
please, guys (and gals!), if you know how to do this, please share with
me!

Thanks a lot for your help!

there is an update option of how often to update, if i remember?
:frequency => ‘9’ or something like that.

anybody else?

gemblon (t.b.) wrote:

Julien Genestoux wrote:

Hi!

I am newbie in AJAX, RJS just a beginer in Rails. Anyway, here is my
problem :
I am bulding an app that will display a list of messages. The last
messages appear at the top of the list. For now, it’s static, the list
is updated only if the user “refreshes” the web page… My goal is that
this list is updated without “refreshing” the whole page, with new
messages appearing at the top!

I am sure this is easy in rails, but, hey, as I said, I am beginer, so
please, guys (and gals!), if you know how to do this, please share with
me!

Thanks a lot for your help!

there is an update option of how often to update, if i remember?
:frequency => ‘9’ or something like that.

anybody else?

Hi,
ur problem has solved or not?

Srinivas Avasarala

Sorry guys, I really don’t get what you’re telling me… Where should I
put “:frequency => ‘9’”?

Thanks for your help, anyway!

Srinivas Avasarala wrote:

gemblon (t.b.) wrote:

Julien Genestoux wrote:

Hi!

I am newbie in AJAX, RJS just a beginer in Rails. Anyway, here is my
problem :
I am bulding an app that will display a list of messages. The last
messages appear at the top of the list. For now, it’s static, the list
is updated only if the user “refreshes” the web page… My goal is that
this list is updated without “refreshing” the whole page, with new
messages appearing at the top!

I am sure this is easy in rails, but, hey, as I said, I am beginer, so
please, guys (and gals!), if you know how to do this, please share with
me!

Thanks a lot for your help!

there is an update option of how often to update, if i remember?
:frequency => ‘9’ or something like that.

anybody else?

Hi,
ur problem has solved or not?

Srinivas Avasarala

–>
what is ur requirement?
what i understood is, when go to list page,
u should get all the messages, automatically, without refreshing…
is this correct?..

Exactly… and one a new message arrives, the list of messages should
update with the new message at the top!

Julien Genestoux wrote:

Sorry guys, I really don’t get what you’re telling me… Where should I
put “:frequency => ‘9’”?

Thanks for your help, anyway!

Srinivas Avasarala wrote:

gemblon (t.b.) wrote:

Julien Genestoux wrote:

Hi!

I am newbie in AJAX, RJS just a beginer in Rails. Anyway, here is my
problem :
I am bulding an app that will display a list of messages. The last
messages appear at the top of the list. For now, it’s static, the list
is updated only if the user “refreshes” the web page… My goal is that
this list is updated without “refreshing” the whole page, with new
messages appearing at the top!

I am sure this is easy in rails, but, hey, as I said, I am beginer, so
please, guys (and gals!), if you know how to do this, please share with
me!

Thanks a lot for your help!

there is an update option of how often to update, if i remember?
:frequency => ‘9’ or something like that.

anybody else?

Hi,
ur problem has solved or not?

Srinivas Avasarala

–>
what is ur requirement?
what i understood is, when go to list page,
u should get all the messages, automatically, without refreshing…
is this correct?..

Exactly… and one a new message arrives, the list of messages should
update with the new message at the top!

Srinivas Avasarala wrote:

Julien Genestoux wrote:

Sorry guys, I really don’t get what you’re telling me… Where should I
put “:frequency => ‘9’”?

Thanks for your help, anyway!

Srinivas Avasarala wrote:

gemblon (t.b.) wrote:

Julien Genestoux wrote:

Hi!

I am newbie in AJAX, RJS just a beginer in Rails. Anyway, here is my
problem :
I am bulding an app that will display a list of messages. The last
messages appear at the top of the list. For now, it’s static, the list
is updated only if the user “refreshes” the web page… My goal is that
this list is updated without “refreshing” the whole page, with new
messages appearing at the top!

I am sure this is easy in rails, but, hey, as I said, I am beginer, so
please, guys (and gals!), if you know how to do this, please share with
me!

Thanks a lot for your help!

there is an update option of how often to update, if i remember?
:frequency => ‘9’ or something like that.

anybody else?

Hi,
ur problem has solved or not?

Srinivas Avasarala

–>
what is ur requirement?
what i understood is, when go to list page,
u should get all the messages, automatically, without refreshing…
is this correct?..

–>
what is ur requirement?
what i understood is, when go to list page,
u should get all the messages, automatically, without refreshing…
is this correct?..

Srinivas Avasarala.

Srinivas Avasarala wrote:

Julien Genestoux wrote:

Sorry guys, I really don’t get what you’re telling me… Where should I
put “:frequency => ‘9’”?

it is a different call. you can do a remote periodic update or
(observer?)
here is a page that should help you, with an example:

http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html

Julien Genestoux wrote:

Exactly… and one a new message arrives, the list of messages should
update with the new message at the top!

Hi,

change ur form tag in rhtml file as below

<%= form_remote_tag( :update => “table”,
:url => {:controller => ‘name of ur controller’, :action
=> :search}) %>
<%= submit_tag ‘Search’%> ----> submit button

<%= end_form_tag %> —>closing tag

action --> ur required action.

in which page u want to show the output,
so in that page, copy the below code…

this will work, only when u press the submit button

other option -->

<%= link_to_remote(“list”, :update => ‘table’, :url =>{
:controller=>‘name of controller’,:action => :search, :id => give ur id
})%>

in which page u want to show the output,
so in that page, copy the below code…

–> this will work, only after click on this link…

Srinivas Avasarala.