fix bugs
This commit is contained in:
parent
d1d92cc97c
commit
1b21757754
|
@ -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 {
|
||||
|
|
|
@ -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<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 = false;
|
||||
this._deletedIndex=undefined;
|
||||
|
@ -229,10 +233,18 @@ define([ 'text!spreadsheeteditor/main/app/template/WatchDialog.template',
|
|||
},
|
||||
|
||||
onDeleteWatch: function() {
|
||||
var me = this;
|
||||
var rec = this.watchList.getSelectedRec();
|
||||
if (rec) {
|
||||
this._deletedIndex = this.watchList.store.indexOf(rec);
|
||||
this.api.asc_deleteCellWatches([rec.get('props')]);
|
||||
if(this.watchList.options.multiSelect) {
|
||||
_.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