jeudi 8 octobre 2015

Ember.computed.sort does not properly observe anymore on ember 2.1.0

I have an Ember.computed.sort property in a model, and it used to work fine on ember 2.0.x. I recently updated to ember 2.1.0 and all of a sudden it stopped working.

The property definition is this:

modules: DS.hasMany('module'), 

sortedModules: Ember.computed.sort('modules.@each.position', function (mod1, mod2) { 
    return mod1.get('position') - mod2.get('position') 
}),

Now it sorts on application start up, but whenever a module.position is changed, it does not re-sort the array: the template is not updated (it should show these modules in correct order), and if I log the module objects, I can see that the order is not change.

Any idea?




Aucun commentaire:

Enregistrer un commentaire