commit dda5deb153e5c9807e798c44c70fbed7a7b049b3 parent 0dd35b952a47bb0a964387a3f7680eb926c83455 Author: Dan Stillman <dstillman@zotero.org> Date: Wed, 27 Jun 2012 23:27:57 -0400 Fix preservation of open/close states after deletions Diffstat:
| M | chrome/content/zotero/xpcom/itemTreeView.js | | | 16 | +++++----------- |
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/chrome/content/zotero/xpcom/itemTreeView.js b/chrome/content/zotero/xpcom/itemTreeView.js @@ -1804,15 +1804,6 @@ Zotero.ItemTreeView.prototype.saveOpenState = function(close) { this._refreshHashMap(); } return itemIDs; - - - var ids = []; - for (var i=0, len=this.rowCount; i<len; i++) { - if (this.isContainer(i) && this.isContainerOpen(i)) { - ids.push(this._getItemAtRow(i).ref.id); - } - } - return ids; } @@ -1821,12 +1812,15 @@ Zotero.ItemTreeView.prototype.rememberOpenState = function(itemIDs) { for each(var id in itemIDs) { var row = this._itemRowMap[id]; // Item may not still exist - if (!row) { + if (row == undefined) { continue; } rowsToOpen.push(row); } - rowsToOpen.sort(); + rowsToOpen.sort(function (a, b) { + return a - b; + }); + this._treebox.beginUpdateBatch(); // Reopen from bottom up for (var i=rowsToOpen.length-1; i>=0; i--) {