removed check for multiselect

This commit is contained in:
OVSharova 2022-10-15 16:16:42 +03:00
parent 4ac240a7b1
commit b21a33601e

View file

@ -192,12 +192,8 @@ define([ 'text!spreadsheeteditor/main/app/template/WatchDialog.template',
if (this._deletedIndex!==undefined) { if (this._deletedIndex!==undefined) {
var store = this.watchList.store; var store = this.watchList.store;
(store.length>0) && this.watchList.selectByIndex(this._deletedIndex<store.length ? this._deletedIndex : store.length-1); (store.length>0) && this.watchList.selectByIndex(this._deletedIndex<store.length ? this._deletedIndex : store.length-1);
if(this.watchList.options.multiSelect) { var selectedRec = this.watchList.getSelectedRec();
var selectedRec = this.watchList.getSelectedRec(); (selectedRec.length > 0) && this.watchList.scrollToRecord(selectedRec[0]);
(selectedRec.length > 0) && this.watchList.scrollToRecord(selectedRec[0]);
}
else
this.watchList.scrollToRecord(this.watchList.getSelectedRec());
this._fromKeyDown && this.watchList.focus(); this._fromKeyDown && this.watchList.focus();
this._fromKeyDown = false; this._fromKeyDown = false;
this._deletedIndex=undefined; this._deletedIndex=undefined;
@ -237,17 +233,12 @@ define([ 'text!spreadsheeteditor/main/app/template/WatchDialog.template',
var me = this; var me = this;
var rec = this.watchList.getSelectedRec(); var rec = this.watchList.getSelectedRec();
if (rec) { if (rec) {
if(this.watchList.options.multiSelect) { var props=[];
var props=[]; _.each(rec, function (r, i) {
_.each(rec, function (r, i) { me._deletedIndex = me.watchList.store.indexOf(r)-props.length;
me._deletedIndex = me.watchList.store.indexOf(r)-props.length; props[i] =r.get('props');
props[i] =r.get('props'); });
}); this.api.asc_deleteCellWatches(props);
this.api.asc_deleteCellWatches(props);
} else {
this._deletedIndex = this.watchList.store.indexOf(rec);
this.api.asc_deleteCellWatches([rec.get('props')]);
}
} }
}, },
@ -270,7 +261,7 @@ define([ 'text!spreadsheeteditor/main/app/template/WatchDialog.template',
}, },
updateButtons: function() { updateButtons: function() {
this.btnDelete.setDisabled(this.watchList.store.length<1 || !this.watchList.getSelectedRec() || (this.watchList.multiSelect && this.watchList.getSelectedRec().length==0)); this.btnDelete.setDisabled(this.watchList.store.length<1 || this.watchList.getSelectedRec().length==0);
this.watchList.scroller && this.watchList.scroller.update({alwaysVisibleY: true}); this.watchList.scroller && this.watchList.scroller.update({alwaysVisibleY: true});
}, },