Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7778561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:25:45+00:00 2026-06-01T18:25:45+00:00

There is a chat, and when new message comes in it needs to scroll

  • 0

There is a chat, and when new message comes in it needs to scroll down. This works fine.

But when app is loaded some portion of messages are preloaded (about 100 of them) via setting the ‘content’ of the ArrayController, so scrolling down will be called 100 times which is not good. What is the right way to run scroll just once for the first big portion of data?

Here is some code http://jsfiddle.net/agentcooper/W6Bhs/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T18:25:47+00:00Added an answer on June 1, 2026 at 6:25 pm

    You could create a scroll function which is fired when your content changes, see http://jsfiddle.net/pangratz666/zZ5Cc. So you’d basically pull up the scrolling behavior from the view which holds a single message to the view which holds all messages.

    Handlebars:

    <script type="text/x-handlebars">
      {{#view App.MessagesView class="message-list" messagesBinding="App.messages" }}
      <ul class="nav nav-list">
      {{#each messages}}
        {{#view App.MessageView contentBinding="this" tagName="li"}}
          {{unbound content.from}}: {{unbound content.message}}
        {{/view}}
      {{/each}}
      </ul>
      {{/view}}
    </script>
    

    JavaScript:

    App.MessagesView = Ember.View.extend({
        didInsertElement: function() {
            this.scroll();
        },
    
        messagesChanged: function() {
            var that = this;
            // invoke this code in the next RunLoop, when changes are made to DOM
            Ember.run.next(function() {
                that.scroll();
            });
        }.observes('messages.@each'),
    
        scroll: function() {
            console.log('scroll');
            var el = this.$();
            el.scrollTop(el.prop('scrollHeight'));
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there an API to implement Yahoo chat in Flex? Or at least some
I'll try to explain this with an example. I'm writing a chat application. There
There are tons of socket.io how to's to create the simplest chat room but
Is there a way to programmatically launch a chat client (eg: MSN Messenger) and
I'm making a chat responder for a game and i want know if there
There is previous little on the google on this subject other than people asking
This is specifically about GWT's RequestBuilder, but should apply to general XHR as well.
Right now the setup for my javascript chat works so it's like function getNewMessage()
I have an app that connects to a remote chat server and then the
I am making a chat window, i just want that message and date time

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.