add currentSelectedRec

This commit is contained in:
OVSharova 2022-10-03 09:42:45 +03:00
parent 8fa0319f5e
commit 560ecfc366

View file

@ -394,26 +394,26 @@ define([
if (suspendEvents) if (suspendEvents)
this.suspendEvents(); this.suspendEvents();
if (!this.multiSelect || ( !this.pressedShift && !this.pressedCtrl) || ! this.lastSelectedRec) { if (!this.multiSelect || ( !this.pressedShift && !this.pressedCtrl) || ! this.currentSelectedRec) {
_.each(this.store.where({selected: true}), function(rec){ _.each(this.store.where({selected: true}), function(rec){
rec.set({selected: false}); rec.set({selected: false});
}); });
if (record) { if (record) {
record.set({selected: true}); record.set({selected: true});
this.lastSelectedRec = record; this.currentSelectedRec = record;
} }
} else { } else {
if (record) { if (record) {
if(this.pressedCtrl) { if(this.pressedCtrl) {
record.set({selected: !record.get('selected')}); record.set({selected: !record.get('selected')});
this.lastSelectedRec = record; this.currentSelectedRec = record;
} }
else if(this.pressedShift){ else if(this.pressedShift){
var me =this; var me =this;
var inRange=false; var inRange=false;
_.each(me.store.models, function(rec){ _.each(me.store.models, function(rec){
if(me.lastSelectedRec == rec || record == rec){ if(me.currentSelectedRec == rec || record == rec){
inRange = !inRange; inRange = !inRange;
rec.set({selected: true}); rec.set({selected: true});
} }
@ -608,7 +608,7 @@ define([
this.setDisabled(this.disabled); this.setDisabled(this.disabled);
this.attachKeyEvents(); this.attachKeyEvents();
//this.lastSelectedRec = null; this.lastSelectedRec = null;
this._layoutParams = undefined; this._layoutParams = undefined;
}, },
@ -666,7 +666,7 @@ define([
} }
} }
} }
//this.lastSelectedRec = null; this.lastSelectedRec = null;
var tip = view.$el.data('bs.tooltip'); var tip = view.$el.data('bs.tooltip');
if (tip) (tip.tip()).remove(); if (tip) (tip.tip()).remove();
@ -684,7 +684,7 @@ define([
window._event = e; // for FireFox only window._event = e; // for FireFox only
if (this.showLast) this.selectRecord(record); if (this.showLast) this.selectRecord(record);
//this.lastSelectedRec = null; this.lastSelectedRec = null;
if (!this.isSuspendEvents) { if (!this.isSuspendEvents) {
this.trigger('item:dblclick', this, view, record, e); this.trigger('item:dblclick', this, view, record, e);
@ -730,10 +730,10 @@ define([
data.preventDefault(); data.preventDefault();
data.stopPropagation(); data.stopPropagation();
var rec = this.getSelectedRec(); var rec = this.getSelectedRec();
/*if (this.lastSelectedRec === null) if (this.lastSelectedRec === null)
this.lastSelectedRec = rec;*/ this.lastSelectedRec = rec;
if (data.keyCode == Common.UI.Keys.RETURN) { if (data.keyCode == Common.UI.Keys.RETURN) {
//this.lastSelectedRec = null; this.lastSelectedRec = null;
if (this.selectedBeforeHideRec) // only for ComboDataView menuPicker if (this.selectedBeforeHideRec) // only for ComboDataView menuPicker
rec = this.selectedBeforeHideRec; rec = this.selectedBeforeHideRec;
this.trigger('item:click', this, this, rec, e); this.trigger('item:click', this, this, rec, e);
@ -851,7 +851,7 @@ define([
if ( this.lastSelectedRec) { if ( this.lastSelectedRec) {
this.selectRecord(this.lastSelectedRec, true); this.selectRecord(this.lastSelectedRec, true);
this.scrollToRecord(this.lastSelectedRec); this.scrollToRecord(this.lastSelectedRec);
//this.lastSelectedRec = null; this.lastSelectedRec = null;
} else { } else {
this.scrollToRecord(this.getSelectedRec()); this.scrollToRecord(this.getSelectedRec());
} }