vendredi 23 mars 2018

Ember.computed.sort on belongsTo properties

I am trying to use Ember.computed.sort and can't figure out how to sort by the name of a belongTo property. I have been on GOogle for hours and can't find the right combination. help please!

// my model
export default DS.Model.extend({
        targetName: DS.attr(),
        targetType: DS.attr(),
        rack: DS.belongsTo('rack', {async: true}),
});

// this works:
export default Ember.Controller.extend({
    sortedTargets: Ember.computed.sort('model', 'sortDefinition'),
    sortDefinition: ['targetType']
});

// this doesn't work :
export default Ember.Controller.extend({
    sortedTargets: Ember.computed.sort('model', 'sortDefinition'),
    sortDefinition: ['rack.name']
});




Aucun commentaire:

Enregistrer un commentaire