From ed058f75e5a8e62a6244bbce1e2c83fbe75994ab Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 3 Apr 2007 05:01:38 +0000 Subject: [PATCH] - Fixed an error when moving collections - Select collection when moving under another collection (by opening parent first) - Streamlined collection load/notify code a bit --- .../zotero/xpcom/collectionTreeView.js | 150 ++++++++++++------ 1 file changed, 99 insertions(+), 51 deletions(-) diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js index f79a2f84c..a918ef161 100644 --- a/chrome/content/zotero/xpcom/collectionTreeView.js +++ b/chrome/content/zotero/xpcom/collectionTreeView.js @@ -34,12 +34,8 @@ Zotero.CollectionTreeView = function() { this._treebox = null; - this.refresh(); - this.itemToSelect = null; - this._highlightedRows = {}; - this._unregisterID = Zotero.Notifier.registerObserver(this, ['collection', 'search']); } @@ -71,6 +67,8 @@ Zotero.CollectionTreeView.prototype.setTree = function(treebox) } }, false); + this.refresh(); + //select Library this.selection.select(0); } @@ -81,7 +79,9 @@ Zotero.CollectionTreeView.prototype.setTree = function(treebox) */ Zotero.CollectionTreeView.prototype.refresh = function() { - this._dataItems = new Array(); + this.selection.clearSelection(); + var oldCount = this.rowCount; + this._dataItems = []; this.rowCount = 0; this._showItem(new Zotero.ItemGroup('library',null),0,1); @@ -90,10 +90,19 @@ Zotero.CollectionTreeView.prototype.refresh = function() this._showItem(new Zotero.ItemGroup('collection',newRows[i]), 0, this._dataItems.length); //itemgroup ref, level, beforeRow var savedSearches = Zotero.Searches.getAll(); - for(var i = 0; i < savedSearches.length; i++) - this._showItem(new Zotero.ItemGroup('search',savedSearches[i]), 0, this._dataItems.length); //itemgroup ref, level, beforeRow + if (savedSearches) { + for (var i=0; i