I have a Backbone.Pageable collection on which I am trying to do a filter but and reset the collection with the filtered values but after the reset, collection.fullCollection has one less model than the original.
This is my collection:
var todoCollection = Backbone.PageableCollection.extend({
mode:'client',
search: function(letters){
var self = this;
if(letters === "") return this.fullCollection.models;
var pattern = new RegExp(letters,"i");
return this.fullCollection.filter(function(data) {
return pattern.test(data.get("text"));
});
}
});
You can check at this fiddle here.
Your search function should return an instance of todoCollection.
Working fiddle