From 380584986a627ae6bbcf56b20fe9327e418035e3 Mon Sep 17 00:00:00 2001 From: David Norton Date: Fri, 16 Jun 2006 16:30:03 +0000 Subject: [PATCH] [fix] If you do a sort, modify a note, etc. it does not reload the selected item [interface/fix] There will always be a secondary sort on date modified. (fixes the infamous Turkle Toggle issue once and for all) --- .../chromeFiles/content/scholar/itemPane.js | 5 +++- .../content/scholar/itemTreeView.js | 25 +++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/chrome/chromeFiles/content/scholar/itemPane.js b/chrome/chromeFiles/content/scholar/itemPane.js index 4f92300632..7a5b9bf9e6 100644 --- a/chrome/chromeFiles/content/scholar/itemPane.js +++ b/chrome/chromeFiles/content/scholar/itemPane.js @@ -50,7 +50,10 @@ ScholarItemPane = new function() * Loads an item */ function viewItem(thisItem) - { + { + if(_itemBeingEdited && thisItem.getID() == _itemBeingEdited.getID()) + return; + _itemBeingEdited = thisItem; reloadFields(); diff --git a/chrome/chromeFiles/content/scholar/itemTreeView.js b/chrome/chromeFiles/content/scholar/itemTreeView.js index a5b34f0aaf..d649ce552d 100644 --- a/chrome/chromeFiles/content/scholar/itemTreeView.js +++ b/chrome/chromeFiles/content/scholar/itemTreeView.js @@ -233,6 +233,13 @@ Scholar.ItemTreeView.prototype.sort = function() return (typeA > typeB) ? -1 : (typeA < typeB) ? 1 : 0; } } + else if(column.id == 'numNotes') + { + function columnSort(a,b) + { + return b.numNotes() - a.numNotes(); + } + } else { function columnSort(a,b) @@ -241,15 +248,29 @@ Scholar.ItemTreeView.prototype.sort = function() } } + function doSort(a,b) + { + var s = columnSort(a,b); + if(s) + return s; + else + return secondarySort(a,b); + } + function oppositeSort(a,b) { - return(columnSort(a,b) * -1); + return(doSort(a,b) * -1); + } + + function secondarySort(a,b) + { + return (a.getField('dateModified') > b.getField('dateModified')) ? -1 : (a.getField('dateModified') < b.getField('dateModified')) ? 1 : 0; } if(order) this._dataItems.sort(oppositeSort); else - this._dataItems.sort(columnSort); + this._dataItems.sort(doSort); this._refreshHashMap();