fix bugs
This commit is contained in:
parent
d1d92cc97c
commit
1b21757754
|
@ -394,7 +394,7 @@ define([
|
||||||
if (suspendEvents)
|
if (suspendEvents)
|
||||||
this.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){
|
_.each(this.store.where({selected: true}), function(rec){
|
||||||
rec.set({selected: false});
|
rec.set({selected: false});
|
||||||
});
|
});
|
||||||
|
@ -726,10 +726,19 @@ define([
|
||||||
onKeyDown: function (e, data) {
|
onKeyDown: function (e, data) {
|
||||||
if ( this.disabled ) return;
|
if ( this.disabled ) return;
|
||||||
if (data===undefined) data = e;
|
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.preventDefault();
|
||||||
data.stopPropagation();
|
data.stopPropagation();
|
||||||
var rec = this.getSelectedRec();
|
var rec = this.currentSelectedRec;
|
||||||
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) {
|
||||||
|
@ -741,16 +750,8 @@ define([
|
||||||
this.trigger('entervalue', this, rec, e);
|
this.trigger('entervalue', this, rec, e);
|
||||||
if (this.parentMenu)
|
if (this.parentMenu)
|
||||||
this.parentMenu.hide();
|
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 {
|
} else {
|
||||||
var idx = _.indexOf(this.store.models, rec);
|
var idx = _.indexOf(this.store.models, this.lastSelectedRec);
|
||||||
if (idx<0) {
|
if (idx<0) {
|
||||||
if (data.keyCode==Common.UI.Keys.LEFT) {
|
if (data.keyCode==Common.UI.Keys.LEFT) {
|
||||||
var target = $(e.target).closest('.dropdown-submenu.over');
|
var target = $(e.target).closest('.dropdown-submenu.over');
|
||||||
|
@ -823,6 +824,7 @@ define([
|
||||||
this.selectRecord(rec);
|
this.selectRecord(rec);
|
||||||
this.scrollToRecord(rec);
|
this.scrollToRecord(rec);
|
||||||
this._fromKeyDown = false;
|
this._fromKeyDown = false;
|
||||||
|
this.lastSelectedRec = rec;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -191,8 +191,12 @@ define([ 'text!spreadsheeteditor/main/app/template/WatchDialog.template',
|
||||||
this.watchList.store.reset(arr);
|
this.watchList.store.reset(arr);
|
||||||
if (this._deletedIndex!==undefined) {
|
if (this._deletedIndex!==undefined) {
|
||||||
var store = this.watchList.store;
|
var store = this.watchList.store;
|
||||||
|
var me = this;
|
||||||
(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);
|
||||||
this.watchList.scrollToRecord(this.watchList.getSelectedRec());
|
if(this.watchList.options.multiSelect)
|
||||||
|
_.each(this.watchList.getSelectedRec(),function (rec){me.watchList.scrollToRecord(rec);});
|
||||||
|
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;
|
||||||
|
@ -229,10 +233,18 @@ define([ 'text!spreadsheeteditor/main/app/template/WatchDialog.template',
|
||||||
},
|
},
|
||||||
|
|
||||||
onDeleteWatch: function() {
|
onDeleteWatch: function() {
|
||||||
|
var me = this;
|
||||||
var rec = this.watchList.getSelectedRec();
|
var rec = this.watchList.getSelectedRec();
|
||||||
if (rec) {
|
if (rec) {
|
||||||
this._deletedIndex = this.watchList.store.indexOf(rec);
|
if(this.watchList.options.multiSelect) {
|
||||||
this.api.asc_deleteCellWatches([rec.get('props')]);
|
_.each(rec, function (r) {
|
||||||
|
me._deletedIndex = me.watchList.store.indexOf(r);
|
||||||
|
me.api.asc_deleteCellWatches([r.get('props')]);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this._deletedIndex = this.watchList.store.indexOf(rec);
|
||||||
|
this.api.asc_deleteCellWatches([rec.get('props')]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue