Fix preservation of open/close states after deletions

This commit is contained in:
Dan Stillman 2012-06-27 23:27:57 -04:00
parent 0dd35b952a
commit dda5deb153

View file

@ -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--) {