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 7545551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:57:35+00:00 2026-05-30T08:57:35+00:00

Trying to figure this concept out. If you console.log this.get(content) before and after the

  • 0

Trying to figure this concept out. If you console.log this.get(“content”) before and after the sort, everything seems like it worked, but when it displays to the screen it gets funky. I think the issue is with Handlebars. When it “sorts” it adds a duplicate fourth record and sticks it at the top. You can see the problem in action here:

http://jsfiddle.net/skinneejoe/Qpkz5/78/ (Click the ‘Sort by Age’ text a couple times to resort the records and you’ll see the issues)

Am I doing something wrong, is there a better way, or is this a bug? If it’s a bug is there a good workaround?

Here’s the full code:

index.html

    <script type="text/x-handlebars">
    {{#view App.SortView}}Sort by Age{{/view}}<br/>

    {{#each App.userController}}
        {{#view App.RecordView contentBinding="this"}}
            {{content.name}} - {{content.age}}
        {{/view}}
    {{/each}}
    </script>

app.js

window.App = Ember.Application.create();

App.userController = Ember.ArrayController.create({
    content: [
        Ember.Object.create({ name:"Jeff", age:24 }),
        Ember.Object.create({ name:"Mark", age:32 }),
        Ember.Object.create({ name:"Jim", age:12 })
    ],
    sort:"desc",
    sortContent:function() {

        if (this.get("sort") == "desc") {
            this.set("sort", "asc");
        } else {
            this.set("sort","desc")
        }

        if (this.get("sort") == "asc") {
            var sortedContent = this.get("content").sort( function(a,b){
                return a.get("age") - b.get("age");
            })
        } else {
            var sortedContent = this.get("content").sort( function(a,b){
                return b.get("age") - a.get("age");
            })
        }

        this.set("content", []);
        this.set("content",sortedContent)
    }
})

App.RecordView = Ember.View.extend({})

App.SortView = Ember.View.extend({
    click: function() {
        App.userController.sortContent("poId")
    }
})
  • 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-05-30T08:57:37+00:00Added an answer on May 30, 2026 at 8:57 am

    I’m not seeing this bug in Safari, Chrome or Firefox on OS X, so I assume it’s a IE issue.

    Sounds a lot like this reported Ember bug, which got fixed 11 days ago. Try upgrading to ember-latest and see if that fixes it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been trying to figure this out for quite some time, and it seems
Hello I'm just trying to figure out the concept of this example menu http://www.cdrking.com
Trying to figure this out... I'm trying to accessthe top level of the dom
Been trying to figure this out, but can't come up with a good solution
Still trying to figure this out from yesterday. I am trying to scroll an
Been trying to figure this out.. I am new to Adroid and trying to
I've been trying to figure this out now for a few hours and its
I've been trying to figure this out for hours, so thought I should ask
I've been trying to figure this one out for a bit using patterns or
I have been trying to figure this out for quite a while, but what

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.