[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:
parent
4904c04e3e
commit
380584986a
chrome/chromeFiles/content/scholar
|
@ -50,7 +50,10 @@ ScholarItemPane = new function()
|
||||||
* Loads an item
|
* Loads an item
|
||||||
*/
|
*/
|
||||||
function viewItem(thisItem)
|
function viewItem(thisItem)
|
||||||
{
|
{
|
||||||
|
if(_itemBeingEdited && thisItem.getID() == _itemBeingEdited.getID())
|
||||||
|
return;
|
||||||
|
|
||||||
_itemBeingEdited = thisItem;
|
_itemBeingEdited = thisItem;
|
||||||
|
|
||||||
reloadFields();
|
reloadFields();
|
||||||
|
|
|
@ -233,6 +233,13 @@ Scholar.ItemTreeView.prototype.sort = function()
|
||||||
return (typeA > typeB) ? -1 : (typeA < typeB) ? 1 : 0;
|
return (typeA > typeB) ? -1 : (typeA < typeB) ? 1 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(column.id == 'numNotes')
|
||||||
|
{
|
||||||
|
function columnSort(a,b)
|
||||||
|
{
|
||||||
|
return b.numNotes() - a.numNotes();
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
function columnSort(a,b)
|
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)
|
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)
|
if(order)
|
||||||
this._dataItems.sort(oppositeSort);
|
this._dataItems.sort(oppositeSort);
|
||||||
else
|
else
|
||||||
this._dataItems.sort(columnSort);
|
this._dataItems.sort(doSort);
|
||||||
|
|
||||||
this._refreshHashMap();
|
this._refreshHashMap();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user