Fix some errors in the tree during add/remove operations
This commit is contained in:
parent
9c0ad65172
commit
8caecdf91a
2 changed files with 7 additions and 1 deletions
|
@ -281,6 +281,8 @@ Zotero.CollectionTreeView.prototype.notify = function(action, type, ids)
|
||||||
var madeChanges = false;
|
var madeChanges = false;
|
||||||
|
|
||||||
if (action == 'delete') {
|
if (action == 'delete') {
|
||||||
|
var selectedIndex = this.selection.count ? this.selection.selectedIndex : 0;
|
||||||
|
|
||||||
//Since a delete involves shifting of rows, we have to do it in order
|
//Since a delete involves shifting of rows, we have to do it in order
|
||||||
|
|
||||||
//sort the ids by row
|
//sort the ids by row
|
||||||
|
@ -324,6 +326,10 @@ Zotero.CollectionTreeView.prototype.notify = function(action, type, ids)
|
||||||
|
|
||||||
this._refreshHashMap();
|
this._refreshHashMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.selection.count) {
|
||||||
|
this.selection.select(selectedIndex)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(action == 'move')
|
else if(action == 'move')
|
||||||
{
|
{
|
||||||
|
|
|
@ -310,7 +310,7 @@ Zotero.ItemTreeView.prototype.notify = function(action, type, ids, extraData)
|
||||||
|
|
||||||
// Select the last item even if there are no changes (e.g. if the tag
|
// Select the last item even if there are no changes (e.g. if the tag
|
||||||
// selector is open and already refreshed the pane)
|
// selector is open and already refreshed the pane)
|
||||||
if (splitIDs.length > 0) {
|
if (splitIDs.length > 0 && (action == 'add' || action == 'modify')) {
|
||||||
var selectItem = splitIDs[splitIDs.length - 1];
|
var selectItem = splitIDs[splitIDs.length - 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue