[interface] collection stays selected on drag-and-drop.
[interface] Collections notify() cleaned up a bit.
This commit is contained in:
parent
9daa0d3303
commit
14ba1b8fbc
1 changed files with 22 additions and 19 deletions
|
@ -81,28 +81,21 @@ Scholar.CollectionTreeView.prototype.notify = function(action, type, ids)
|
|||
this._treebox.invalidate();
|
||||
this._treebox.endUpdateBatch();
|
||||
}
|
||||
else
|
||||
else if(action == 'modify')
|
||||
{
|
||||
ids = Scholar.flattenArguments(ids);
|
||||
for (var i=0, len=ids.length; i<len; i++)
|
||||
{
|
||||
|
||||
var row = this._collectionRowMap[ids[i]];
|
||||
if(action == 'modify' && row != null) //must check for null because it could legitimately be 0
|
||||
{
|
||||
this._treebox.invalidateRow(row)
|
||||
var row = this._collectionRowMap[ids];
|
||||
if(row != null)
|
||||
this._treebox.invalidateRow(row);
|
||||
}
|
||||
else if(action == 'add' && row == null)
|
||||
else if(action == 'add')
|
||||
{
|
||||
var item = Scholar.Collections.get(ids[i]);
|
||||
var item = Scholar.Collections.get(ids);
|
||||
|
||||
this._showItem(new Scholar.ItemGroup('collection',item), 0, this.rowCount);
|
||||
this._treebox.rowCountChanged(this.rowCount-1,1);
|
||||
|
||||
madeChanges = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(madeChanges)
|
||||
this._refreshHashMap();
|
||||
|
@ -292,6 +285,16 @@ Scholar.CollectionTreeView.prototype.drop = function(row, orient)
|
|||
targetCollectionID = this._getItemAtRow(row).ref.getID();
|
||||
var droppedCollection = Scholar.Collections.get(ids[0]);
|
||||
droppedCollection.changeParent(targetCollectionID);
|
||||
|
||||
var selectRow = this._collectionRowMap[ids[0]];
|
||||
if(selectRow == null)
|
||||
selectRow = this._collectionRowMap[targetCollectionID];
|
||||
|
||||
this.selection.selectEventsSuppressed = true;
|
||||
this.selection.clearSelection();
|
||||
this.selection.select(selectRow);
|
||||
this.selection.selectEventsSuppressed = false;
|
||||
|
||||
}
|
||||
else if(dataType == 'scholar/item' && this.canDrop(row, orient))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue