Giter VIP home page Giter VIP logo

Comments (8)

jkeen avatar jkeen commented on July 21, 2024

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.

dlikhten avatar dlikhten commented on July 21, 2024

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.

maiwald avatar maiwald commented on July 21, 2024

👍 We'd love to see those events propagated as well :)

from filtered-collection.

Calamari avatar Calamari commented on July 21, 2024

Thanks @jkeen for the test

from filtered-collection.

dlikhten avatar dlikhten commented on July 21, 2024

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.

Calamari avatar Calamari commented on July 21, 2024

Just want to ask, what the status is about that pull request and that problem? :-)

from filtered-collection.

dlikhten avatar dlikhten commented on July 21, 2024

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.

jkeen avatar jkeen commented on July 21, 2024

Cooooooool, thanks for getting this in.

from filtered-collection.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.