dimanche 21 juin 2015

Sorting data by timestamp on ember

I've looked at a few examples, but haven't been able to reverse-sort, so that newly generated objects are on top.

My sortable items are in components, and I don't think I'm passing sortProperties & sortAscending correctly.

lavender.js:

export default Ember.Controller.extend({
    needs: ['application'],

    sortProperties: ['timestamp'],
    sortAscending: false
});

lavender.hbs

{{#each model.comment as |comment|}}
    {{comment-thread message=comment.message user=comment.user timestamp=comment.timestamp sortProperties=sortProperties sortAscending=sortAscending}}
{{/each}}

comment.js

export default DS.Model.extend({
  message: DS.attr('string'),
  timestamp: DS.attr('date'),

  user: DS.belongsTo('user', {async: true}),
  todo: DS.belongsTo('todo', {async: true}),

});

There must be something I'm not seeing.. thank you!




Aucun commentaire:

Enregistrer un commentaire