Restore unselecting of last row in tree if removed
If no other rows are selected, select the row before the removed row
This commit is contained in:
parent
af7da366c9
commit
03da4a9d52
|
@ -103,6 +103,17 @@ Zotero.LibraryTreeView.prototype = {
|
||||||
*/
|
*/
|
||||||
_removeRow: function (row, skipMapUpdate) {
|
_removeRow: function (row, skipMapUpdate) {
|
||||||
var id = this._rows[row].id;
|
var id = this._rows[row].id;
|
||||||
|
|
||||||
|
var lastRow = row == this.rowCount - 1;
|
||||||
|
if (lastRow && this.selection.isSelected(row)) {
|
||||||
|
// Deslect removed row
|
||||||
|
this.selection.toggleSelect(row);
|
||||||
|
// If no other rows selected, select row before
|
||||||
|
if (this.selection.count == 0 && row !== 0) {
|
||||||
|
this.selection.toggleSelect(row - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this._rows.splice(row, 1);
|
this._rows.splice(row, 1);
|
||||||
this.rowCount--;
|
this.rowCount--;
|
||||||
this._treebox.rowCountChanged(row + 1, -1);
|
this._treebox.rowCountChanged(row + 1, -1);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user