尝试了以下示例,但groupBy无法正常工作
var Todos = new Backbone.Collection();
Todos.add([
{ title: 'go to Belgium.', completed: false },
{ title: 'go to China.', completed: false },
{ title: 'go to Austria.', completed: true }
]);
// create groups of completed and incomplete models
var byCompleted = Todos.groupBy('completed');
var completed = new Backbone.Collection(byCompleted[true]);
console.log(Todos);
TypeError: Todos.groupBy is not a function
[Break On This Error]
var byCompleted = Todos.groupBy('completed');