Hi, I have a text_area that fills in the text from a controller and I am using RJS to update the text area content. I want to set the scroll bar to bottom so that the user need not scroll to bottom to get the updated value, how do I do that I tried page["status"].scrollTop = page["status"].scrollHeight This somehow does not work in the RJS Thanks, Sudhi -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Sudhi Kulkarni wrote:> I have a text_area that fills in the text from a controller and I am > using RJS to update the text area content. I want to set the scroll bar > to bottom so that the user need not scroll to bottom to get the updated > value, how do I do that I tried > > page["status"].scrollTop = page["status"].scrollHeightEvent.observe(window, "load", function() { $(''input_area'').scrollTop = $(''input_area'').scrollHeight; }); This worked in my quick test in Safari 4.0 beta and Firefox 3.0.8, so it looks like the the JavaScript part of what you''re doing is fine. My guess is that you might have a timing issue of some sort. Notice that the above code waits for the page to fully load before scrolling the text area for example. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Robert Walker wrote:> Sudhi Kulkarni wrote: >> I have a text_area that fills in the text from a controller and I am >> using RJS to update the text area content. I want to set the scroll bar >> to bottom so that the user need not scroll to bottom to get the updated >> value, how do I do that I tried >> >> page["status"].scrollTop = page["status"].scrollHeight > > Event.observe(window, "load", function() { > $(''input_area'').scrollTop = $(''input_area'').scrollHeight; > }); > > This worked in my quick test in Safari 4.0 beta and Firefox 3.0.8, so it > looks like the the JavaScript part of what you''re doing is fine. My > guess is that you might have a timing issue of some sort. Notice that > the above code waits for the page to fully load before scrolling the > text area for example.Hi, Thanks for the input... The problem I see is that the textarea content is filled later on and not onload. Does this update the scrollbar position even after the textarea content is updated? Thanks, Sudhi -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---