Ember sortProperties解释道

时间:2013-09-06 04:12:13

标签: sorting properties ember.js

有人可以告诉我为什么这个人的名单在使用

时没有重新排序

sortProperties:['name'],sortAscending:false

我使用的是ember-1.0.0-rc.6和ember数据存储版本13以及DS.FixtureAdapter

App.Person = DS.Model.extend({
name: DS.attr('string'),
trackNumber: DS.attr('number'),
})

App.Person.FIXTURES = [
{id: 1, name: 'aron face', trackNumber: 2},
{id: 2, name: 'bob sinclair', trackNumber: 1}
];

App.PersonsRoute = Ember.Route.extend({
model: function() {
return App.Person.find();
}
});

App.Router.map(function() {
this.resource('persons', function() {
this.resource('person', { path: ':person_id' });
});
});

App.ApplicationController = Ember.Controller.extend();

App.PersonsController = Ember.ArrayController.extend({
sortProperties: ['name'],
sortAscending: false,

newPerson: function(){
    App.Person.createRecord({id: new Date().getTime(), name: 'Created person'});
},
remove: function () { .... }
});

App.personView = Em.View.extend({ ... });

0 个答案:

没有答案