EXT Enter切换焦点问题
Enter键替代Tab键切换焦点(Ext)
一、el
var el =Ext.get('例如:formname');
var map = new Ext.KeyMap(el, {
key: Ext.EventObject.ENTER,
fn: function(){
event.keyCode=9;
}
});
二、EditGrid,需修改源码
onEditorKey:function (F, E) {
var C = E.getKey(), G, D = this.grid, B = D.activeEditor;
var A = E.shiftKey;
if (C == E.TAB) {
E.stopEvent();
B.completeEdit();
if (A) {
G = D.walkCells(B.row, B.col - 1, -1, this.acceptsNav, this);
} else {
G = D.walkCells(B.row, B.col + 1, 1, this.acceptsNav, this);
}
} else {
if (C == E.ENTER) {
E.stopEvent();
B.completeEdit();
if (this.moveEditorOnEnter !== false) {
if (A) {
//G = D.walkCells(B.row - 1, B.col, -1, this.acceptsNav,this)
G = D.walkCells(B.row, B.col - 1, -1, this.acceptsNav, this);
} else {
// G = D.walkCells(B.row + 1, B.col, 1, this.acceptsNav,this)
G = D.walkCells(B.row, B.col + 1, 1, this.acceptsNav, this);
}
}
} else {
if (C == E.ESC) {
B.cancelEdit();
}
}
}
if (G) {
D.startEditing(G[0], G[1]);
}
}