Backbone.js collection comparator sort by multiple fields?

后端 未结 5 1353
臣服心动
臣服心动 2020-12-14 06:11
  this.col = Backbone.Collection.extend({
    model: M,
    comparator: function(item) {
      return item.get(\"level\");
    }
  });

This above c

5条回答
  •  没有蜡笔的小新
    2020-12-14 06:24

    Returning an array is not consistent if you need to sort descending and some ascending...

    I created a small set of functions which can be used to return the relevant comparison integer back to Backbone Comparator function:

    backbone-collection-multisort

提交回复
热议问题