Run _loadChildItems() in Collection.loadFromRow() so that _childItems.length is calculated properly

This commit is contained in:
Dan Stillman 2006-08-15 20:38:20 +00:00
parent 7f13072ef4
commit 844fcc0ee9

View file

@ -2214,6 +2214,7 @@ Scholar.Collection.prototype.loadFromRow = function(row){
this._parent = row['parentCollectionID'];
this._hasChildCollections = row['hasChildCollections'];
this._hasChildItems = row['hasChildItems'];
this._loadChildItems();
}
@ -2348,6 +2349,7 @@ Scholar.Collection.prototype.addItem = function(itemID){
// If this was previously empty, update and send a notification to the tree
if (!this._hasChildItems){
this._hasChildItems = true;
// DEBUG: is this necessary?
Scholar.Notifier.trigger('modify', 'collection', this.getID());
}
@ -2388,6 +2390,7 @@ Scholar.Collection.prototype.removeItem = function(itemID){
// If this was the last item, set collection to empty
if (!this._childItems.length){
this._hasChildItems = false;
// DEBUG: is this necessary?
Scholar.Notifier.trigger('modify', 'collection', this.getID());
}