[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)
This commit is contained in:
David Norton 2006-06-16 16:30:03 +00:00
parent 4904c04e3e
commit 380584986a
2 changed files with 27 additions and 3 deletions

View file

@ -50,7 +50,10 @@ ScholarItemPane = new function()
* Loads an item
*/
function viewItem(thisItem)
{
{
if(_itemBeingEdited && thisItem.getID() == _itemBeingEdited.getID())
return;
_itemBeingEdited = thisItem;
reloadFields();

View file

@ -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();