光标在行上横着走
Ext.override(Ext.grid.RowSelectionModel, {
onEditorKey : function(field, e) {
// alert('go');
var k = e.getKey(), newCell, g = this.grid, ed = g.activeEditor;
var shift = e.shiftKey;
Ext.log('k:' + k);
if (k == e.ENTER) {
e.stopEvent();
ed.completeEdit();
if (shift) {
newCell = g.walkCells(ed.row, ed.col - 1, -1,
this.acceptsNav, this);
} else {
// alert('go');
newCell = g.walkCells(ed.row, ed.col + 1, 1,
this.acceptsNav, this);
}
} else if (k == e.TAB) {
e.stopEvent();
ed.completeEdit();
if (this.moveEditorOnEnter !== false) {
if (shift) {
newCell = g.walkCells(ed.row - 1, ed.col, -1,
this.acceptsNav, this);
} else {
// alert('go');
newCell = g.walkCells(ed.row + 1, ed.col, 1,
this.acceptsNav, this);
}
}
} else if (k == e.ESC) {
ed.cancelEdit();
}
if (newCell) {
g.startEditing(newCell[0], newCell[1]);
}
}
});
var sm2 = new Ext.grid.RowSelectionModel({
moveEditorOnEnter : true,
singleSelect : true,
listeners : {
rowselect : function(sm, row, rec) {
centerForm.getForm().loadRecord(rec);
}
}
onEditorKey : function(field, e) {
// alert('go');
var k = e.getKey(), newCell, g = this.grid, ed = g.activeEditor;
var shift = e.shiftKey;
Ext.log('k:' + k);
if (k == e.ENTER) {
e.stopEvent();
ed.completeEdit();
if (shift) {
newCell = g.walkCells(ed.row, ed.col - 1, -1,
this.acceptsNav, this);
} else {
// alert('go');
newCell = g.walkCells(ed.row, ed.col + 1, 1,
this.acceptsNav, this);
}
} else if (k == e.TAB) {
e.stopEvent();
ed.completeEdit();
if (this.moveEditorOnEnter !== false) {
if (shift) {
newCell = g.walkCells(ed.row - 1, ed.col, -1,
this.acceptsNav, this);
} else {
// alert('go');
newCell = g.walkCells(ed.row + 1, ed.col, 1,
this.acceptsNav, this);
}
}
} else if (k == e.ESC) {
ed.cancelEdit();
}
if (newCell) {
g.startEditing(newCell[0], newCell[1]);
}
}
});
var sm2 = new Ext.grid.RowSelectionModel({
moveEditorOnEnter : true,
singleSelect : true,
listeners : {
rowselect : function(sm, row, rec) {
centerForm.getForm().loadRecord(rec);
}
}
});