diff --git a/apps/common/main/lib/component/DataView.js b/apps/common/main/lib/component/DataView.js index 03c3a9f48..5eb020022 100644 --- a/apps/common/main/lib/component/DataView.js +++ b/apps/common/main/lib/component/DataView.js @@ -738,7 +738,7 @@ define([ if (_.indexOf(this.moveKeys, data.keyCode)>-1 || data.keyCode==Common.UI.Keys.RETURN) { data.preventDefault(); data.stopPropagation(); - var rec =(this.multiSelect) ? this.currentSelectedRec : this.getSelectedRec(); + var rec =(this.multiSelect) ? this.extremeSeletedRec : this.getSelectedRec(); if (this.lastSelectedRec === null) this.lastSelectedRec = rec; if (data.keyCode == Common.UI.Keys.RETURN) { @@ -752,7 +752,7 @@ define([ this.parentMenu.hide(); } else { this.pressedCtrl=false; - var idx = (!this.multiSelect)? _.indexOf(this.store.models, rec):_.indexOf(this.store.models, this.extremeSeletedRec); + var idx = _.indexOf(this.store.models, rec); if (idx<0) { if (data.keyCode==Common.UI.Keys.LEFT) { var target = $(e.target).closest('.dropdown-submenu.over'); @@ -856,7 +856,10 @@ define([ this.lastSelectedRec = null; } else { var selectedRec = this.getSelectedRec(); - this.scrollToRecord((!this.multiSelect) ? selectedRec : selectedRec[selectedRec.length - 1]); + if (!this.multiSelect) + this.scrollToRecord(selectedRec); + else if(selectedRec.length > 0) + this.scrollToRecord(selectedRec[selectedRec.length - 1]); } }, diff --git a/apps/spreadsheeteditor/main/app/view/WatchDialog.js b/apps/spreadsheeteditor/main/app/view/WatchDialog.js index 0a72f6e65..02c739c96 100644 --- a/apps/spreadsheeteditor/main/app/view/WatchDialog.js +++ b/apps/spreadsheeteditor/main/app/view/WatchDialog.js @@ -192,8 +192,10 @@ define([ 'text!spreadsheeteditor/main/app/template/WatchDialog.template', if (this._deletedIndex!==undefined) { var store = this.watchList.store; (store.length>0) && this.watchList.selectByIndex(this._deletedIndex 0) && this.watchList.scrollToRecord(selectedRec[0]); + } else this.watchList.scrollToRecord(this.watchList.getSelectedRec()); this._fromKeyDown && this.watchList.focus(); @@ -238,7 +240,7 @@ define([ 'text!spreadsheeteditor/main/app/template/WatchDialog.template', if(this.watchList.options.multiSelect) { var props=[]; _.each(rec, function (r, i) { - me._deletedIndex = me.watchList.store.indexOf(r); + me._deletedIndex = me.watchList.store.indexOf(r)-props.length; props[i] =r.get('props'); }); this.api.asc_deleteCellWatches(props); @@ -268,7 +270,7 @@ define([ 'text!spreadsheeteditor/main/app/template/WatchDialog.template', }, updateButtons: function() { - this.btnDelete.setDisabled(this.watchList.store.length<1 || !this.watchList.getSelectedRec()); + this.btnDelete.setDisabled(this.watchList.store.length<1 || !this.watchList.getSelectedRec() || (this.watchList.multiSelect && this.watchList.getSelectedRec().length==0)); this.watchList.scroller && this.watchList.scroller.update({alwaysVisibleY: true}); },