Giving models an index/weight


#1

Hi, assuming a list of posts, how would you give them an index for sorting? I would initially like to show which post is number 1, 2 based on date. It can not depend on the model id, in case a post is deleted.

Bonus question, if the same property could be used for drag’n’drop sorting later, it would be great. Of course it can’t depend on date then.


#2

Put them in an ArrayController and configure that controller to sort based on number and date:

http://emberjs.com/api/classes/Ember.SortableMixin.html