diff --git a/lib/model.js b/lib/model.js index d2288e6..c353be3 100644 --- a/lib/model.js +++ b/lib/model.js @@ -129,8 +129,15 @@ CKAN.Model = function ($, _, Backbone, undefined) { _createChildren: function () { _.each(this.children, function (Model, key) { if (!this.get(key)) { - this.attributes[key] = new Backbone.Collection(); - this.attributes[key].model = Model; + var newColl = new Backbone.Collection(); + this.attributes[key] = newColl; + newColl.model = Model; + // bind change events so updating the children trigger change on Dataset + var self = this; + // TODO: do we want to do all or be more selective + newColl.bind('all', function() { + self.trigger('change'); + }); } }, this); return this;