backbone.js - Collection change event on an attribute which is a model itself -


I have created a backbone. (Say) Select ModelA and I model a special feature of those people. It is straightforward, ... but ('change: attr1'). This phenomenon is removed at the right time when this is needed, the problem occurs when this feature is another model (model B), which has its own characteristics, if one feature of Modelbie has changed, then the collection is on that event Will not be able to capture (and it is true, the model's attribute has never been changed, "attributes have changed properties").

One idea is from model-B to the model A's wire-up listener and then in the collection. It can work, but we are now adding many listeners to create this series of events. I also suspect that when we do not need them, those listeners will have a pain to open them.

Is there a better way (or alternative) way to do this? Any feedback is appreciated.

Thank you

I think the clear way forward is through the Guardian model See incidents from my example:

But you can override collection methods _addReference and _removeReference to add custom event binding logic.

Hope this helps


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -