$ cnpm install ampersand-collection-sort-mixin
A mixin for extending ampersand-collection with the ability to sort by multiple properties, and ascending/descending. The sorting is performed when adding new models to the collection, or when the sort() method is called.
npm install ampersand-collection-sort-mixin
The mixin uses two properties stored in session properties:
var Collection = require('ampersand-collection');
var sortMixin = require('ampersand-collection-sort-mixin');
module.exports = Collection.extend(sortMixin, {
session: {
sortProps: ['lastname', 'firstname'],
sortDescending: true
},
});
The main nugget of this code came from the base collection sort() method.
MIT
Copyright 2014 - 2016 © taobao.org |