Skip to content


Subversion checkout URL

You can clone with
Download ZIP


global 'change' doesn't work #28

cnlevy opened this Issue · 7 comments

3 participants


it is important to note that you can't listen to associated model changes just by having
this.on('change', callback);
You need to listen to this.on('change:associatedModel', callback)

@dhruvaray dhruvaray was assigned

Can you please give an example or a jsfiddle - which demonstrates the problem you are facing? See this particular test case (highlighted in yellow) which does both change and change:AssociatedModel


here is the jsfiddle :
I'm talking about the case where you do :


Thanks for clarifying. This is deliberate. The rationale for introducing fully qualified paths was that the path would give you info about which node in the hierarchy has changed and you could get the info about the changed node through the event arguments.

We had deliberated about introducing the global change event - at higher levels of the object graph - a couple of times, but settled for fully qualified paths at the end. While it is not difficult to add the change you want, there are some concerns

  1. It would lead to a proliferation of events. In a deeply nested model, for each layer you would have to introduce at least 2 new events : change + change:attribute-name where attribute-name would not be a fully qualified path, but an immediate attribute of the node at that level.

  2. We would have to simulate the events mentioned in pt#1. When you change an attribute in product, you are not really changing the memory reference to product in item. Consequently we cannot delegate (leverage) Backbone base infrastructure to treat it as a change event. Which means we would have to write more custom code and the compactness of the implementation suffers.

  3. We wouldn't want these events to bubble up the hierarchy beyond one level. As it would lead to potentially duplicate events. (As they would also get converted into fully qualified event names at higher levels)

Nonetheless, I will update the pitfalls section of the documentation to make this explicit.


I have updated (4324af7) the pitfalls section of the documentation and cross referenced this issue. I am glad to hear that the extension is useful to your work. If it's possible, do share a URL. I can put up a usage list if I hear from other folks as well. And yes, don't forget to star us if you like the extension!

@dhruvaray dhruvaray closed this
@dhruvaray dhruvaray reopened this
@dhruvaray dhruvaray closed this

With BB-Associations v0.5.0+, you can now use the nested-change event for global events. See your revised fiddle here. For rationale, you can see the nested-change section in the event catalogue documentation.


I just test your last fiddle example using "nested-change" event and it does not work (i use v0.6.2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.