Remove child items from view when removing parent

https://forums.zotero.org/discussion/42218/
This commit is contained in:
Dan Stillman 2014-11-28 16:37:40 -05:00
parent 55068a0059
commit 67c63a2968

View file

@ -568,10 +568,17 @@ Zotero.ItemTreeView.prototype.notify = function(action, type, ids, extraData)
for (var i=0, len=ids.length; i<len; i++) {
if (action == 'delete' || action == 'trash' ||
!itemGroup.ref.hasItem(ids[i])) {
let row = this._itemRowMap[ids[i]];
// Row might already be gone (e.g. if this is a child and
// 'modify' was sent to parent)
if (this._itemRowMap[ids[i]] != undefined) {
rows.push(this._itemRowMap[ids[i]]);
if (row != undefined) {
rows.push(row);
}
// Remove child items of removed parents
if (this.isContainer(row) && this.isContainerOpen(row)) {
while (++row < this.rowCount && this.getLevel(row) > 0) {
rows.push(row);
}
}
}
}