From 1b21757754c8199a2cb779e50c7f31012955706b Mon Sep 17 00:00:00 2001 From: OVSharova Date: Wed, 5 Oct 2022 14:31:55 +0300 Subject: [PATCH] fix bugs --- apps/common/main/lib/component/DataView.js | 26 ++++++++++--------- .../main/app/view/WatchDialog.js | 18 ++++++++++--- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/apps/common/main/lib/component/DataView.js b/apps/common/main/lib/component/DataView.js index 82b91085d..283deaa4e 100644 --- a/apps/common/main/lib/component/DataView.js +++ b/apps/common/main/lib/component/DataView.js @@ -394,7 +394,7 @@ define([ if (suspendEvents) this.suspendEvents(); - if (!this.multiSelect || ( !this.pressedShift && !this.pressedCtrl) || ! this.currentSelectedRec) { + if (!this.multiSelect || ( !this.pressedShift && !this.pressedCtrl) || ! this.currentSelectedRec || this.currentSelectedRec == record) { _.each(this.store.where({selected: true}), function(rec){ rec.set({selected: false}); }); @@ -726,10 +726,19 @@ define([ onKeyDown: function (e, data) { if ( this.disabled ) return; if (data===undefined) data = e; - if (_.indexOf(this.moveKeys, data.keyCode)>-1 || data.keyCode==Common.UI.Keys.RETURN || data.keyCode==Common.UI.Keys.CTRL ||data.keyCode==Common.UI.Keys.SHIFT) { + + if(this.multiSelect) { + if (data.keyCode == Common.UI.Keys.CTRL) { + this.pressedCtrl = true; + } else if (data.keyCode == Common.UI.Keys.SHIFT) { + this.pressedShift = true; + } + } + + if (_.indexOf(this.moveKeys, data.keyCode)>-1 || data.keyCode==Common.UI.Keys.RETURN) { data.preventDefault(); data.stopPropagation(); - var rec = this.getSelectedRec(); + var rec = this.currentSelectedRec; if (this.lastSelectedRec === null) this.lastSelectedRec = rec; if (data.keyCode == Common.UI.Keys.RETURN) { @@ -741,16 +750,8 @@ define([ this.trigger('entervalue', this, rec, e); if (this.parentMenu) this.parentMenu.hide(); - } - else if(this.multiSelect) { - if (data.keyCode==Common.UI.Keys.CTRL){ - this.pressedCtrl = true; - } - else if(data.keyCode==Common.UI.Keys.SHIFT){ - this.pressedShift = true; - } } else { - var idx = _.indexOf(this.store.models, rec); + var idx = _.indexOf(this.store.models, this.lastSelectedRec); if (idx<0) { if (data.keyCode==Common.UI.Keys.LEFT) { var target = $(e.target).closest('.dropdown-submenu.over'); @@ -823,6 +824,7 @@ define([ this.selectRecord(rec); this.scrollToRecord(rec); this._fromKeyDown = false; + this.lastSelectedRec = rec; } } } else { diff --git a/apps/spreadsheeteditor/main/app/view/WatchDialog.js b/apps/spreadsheeteditor/main/app/view/WatchDialog.js index 88039b5a0..4cf5f338d 100644 --- a/apps/spreadsheeteditor/main/app/view/WatchDialog.js +++ b/apps/spreadsheeteditor/main/app/view/WatchDialog.js @@ -191,8 +191,12 @@ define([ 'text!spreadsheeteditor/main/app/template/WatchDialog.template', this.watchList.store.reset(arr); if (this._deletedIndex!==undefined) { var store = this.watchList.store; + var me = this; (store.length>0) && this.watchList.selectByIndex(this._deletedIndex