dhruvaray / backbone-associations

Create object hierarchies with Backbone models; Respond to hierarchy changes using regular Backbone events.
http://dhruvaray.github.io/backbone-associations/
MIT License
492 stars 75 forks source link

nested-changes event not fire. #131

Closed SurendraBorana-GSLab closed 10 years ago

SurendraBorana-GSLab commented 10 years ago

Bind the event on model with nested-changes. If dynamically adding property after binding mention event, it is not fire.

dhruvaray commented 10 years ago

Nested-change event is switched off be default on the latest. You need to turn it on explicitly. Can you share a snippet of what you are tring to achieve?

SurendraBorana-GSLab commented 10 years ago

I enable the nested-change event using Backbone.Associations.EVENTS_NC = true; I created BackupModel with attribute backupId, backupname, sourceAddress, destinationAddress,... Created object of BackupModel and bind the all property change event on same.

After backup initialize , some dynamic attribute added like percentage and backup status. I want to monitor this two attribute change event, but this attribute change event not fire,,

I used the following code. Backbone.Associations.EVENTS_NC = true; var backupModel = new BackupModel(); backupModel.on('nested-change',function(){ //some code here... //THIs code never called });

SurendraBorana-GSLab commented 10 years ago

Please note : percentage and backupStatus not available at the time of creating instance of backup model and binding 'nested-change' event.

dhruvaray commented 10 years ago

Can you please create a jsfiddle so I can take a look at the issue?