Reverse sort order with Backbone.js

前端 未结 15 966
不知归路
不知归路 2020-12-02 05:45

With Backbone.js I\'ve got a collection set up with a comparator function. It\'s nicely sorting the models, but I\'d like to reverse the order.

How can I sort the m

15条回答
  •  栀梦
    栀梦 (楼主)
    2020-12-02 06:33

    For reverse order on id:

    comparator: function(object) { return (this.length - object.id) + 1; }
    

提交回复
热议问题