Comments (8)
Not sure if this is related but an older version of this (from a year ago, not sure of the version number) used to bubble up property change events, but the newest version does not. I'm trying to track it down.
This used to work: this.listenTo(this.collection, 'change:blah', this.blahHandler)
New version does not fire that event, but rather only a general 'change' event. Here's a jasmine test that tests for the behavior:
it("property change events are fired on filtered collection", function() {
var collection = new Backbone.Collection([ {id: 1, difficulty: 1}, {id: 2, difficulty: 2}, {id: 3, difficulty: 1}, {id: 4, difficulty: 3} ]);
var filteredCollection = new Backbone.FilteredCollection(null, {collection: collection});
filteredCollection.setFilter(function(d) { return (d.get('difficulty') === 1) });
var changeCount = 0;
var newModel = new Backbone.Model({id: 5, difficulty: 1});
collection.add(newModel);
filteredCollection.on("change:blah", function() { changeCount = changeCount + 1; });
newModel.set({"blah": "blah"});
expect(changeCount).toEqual(1);
});
from filtered-collection.
Interesting. This could be because I override backbone's change listener so it would not propagate that change event. Something to look into. Thanks for the test.
from filtered-collection.
👍 We'd love to see those events propagated as well :)
from filtered-collection.
Thanks @jkeen for the test
from filtered-collection.
Ok I seriously need to do some merging today :). I'm trying to remember why I disabled the change event propagation. It doesn't make sense that I would...
First of all I think this commit from paginated-collection should be similar to what I want to do here: dlikhten/paginated-collection@c85f9ac
And then I'll integrate the unit tests and see what is going on. Thanks for the commits @Calamari.
from filtered-collection.
Just want to ask, what the status is about that pull request and that problem? :-)
from filtered-collection.
Oy im sorry, i've been too forgetful. It's on my calendar. You can hold me accountable for merging it in tonight.
from filtered-collection.
Cooooooool, thanks for getting this in.
from filtered-collection.
Related Issues (13)
- Filtering should be efficient with add and remove events HOT 1
- Possible issue with inherited _onModelEvent HOT 8
- Adding an element to the filtered results gets tracked incorrectly HOT 1
- Need an event which signifies that filtering is complete HOT 1
- Adding version number HOT 3
- Convert to Gem HOT 1
- Better support for sort
- add to Bower registry HOT 1
- Render my view collection before filter. HOT 2
- #setFilter is a terrible API. Change it. HOT 3
- Create the first library version HOT 1
- Release 1.2.1 to rubygems HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from filtered-collection.