vendredi 22 mai 2015

sorting objects in Ember, Ember.SortableMixin sortProperties not working as expected

I'm new to Ember and recently followed the Ember "getting started" guide to build TodoMVC. Here it is in a jsbin.

Everything works, but now I'm trying to sort the todos by adding sortProperties to the TodosController:

Todos.TodosController = Ember.ArrayController.extend({
    sortProperties: ['title'],
    sortAscending: true,
    ...
});

And in the template, I have this:

{{#each todo in arrangedContent itemController="todo"}}
  ...
{{/each}}

Based on the Ember.SortableMixin documentation, what I'm doing seems to be reasonable but clearly I'm missing something.

Any help would be much appreciated!




Aucun commentaire:

Enregistrer un commentaire