commit 67c63a29681d809981444840ac89e3ccce8595c4 parent 55068a00597c6d6dd2b9cb285ab5688bedded67b Author: Dan Stillman <dstillman@zotero.org> Date: Fri, 28 Nov 2014 16:37:40 -0500 Remove child items from view when removing parent https://forums.zotero.org/discussion/42218/ Diffstat:
| M | chrome/content/zotero/xpcom/itemTreeView.js | | | 11 | +++++++++-- |
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/chrome/content/zotero/xpcom/itemTreeView.js b/chrome/content/zotero/xpcom/itemTreeView.js @@ -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); + } } } }