jeudi 21 décembre 2017

Sorting date not works as per expected

I am trying to sort the amount and date. But the date function not works properly. what is the correct way with ember sorting method?

my code :

import Ember from 'ember';

export default Ember.Controller.extend({
  appName: 'Ember Twiddle',
  sortingDate: ['date-of-purchase:desc'],
    sortingAmout: ['amount:desc'],
    sortByAmountSpent:Ember.computed.sort('model', 'sortingDate'),
    sortByDateOfPurchase:Ember.computed.sort('model', 'sortingAmout')
  ,actions:{
    sortByAmount:function(){
      this.set("model", this.get('sortByAmountSpent'));
    },
    sortByDate:function(){
       this.set("model", this.get('sortByDateOfPurchase'));
    },
  }
});

here is my try :

Twiddle-link




Aucun commentaire:

Enregistrer un commentaire