Please listen to the 'onBeginEdit' event and then bind additional events on each editors.
$('#dg').datagrid({
onBeginEdit: function (index, row) {
const editors = $(this).datagrid('getEditors', index);
editors.forEach((editor) => {
const t = $(editor.target);
if (t.hasClass('textbox-f')) {
t.textbox('textbox').on('keydown', (e) => {
if (e.which == 13) { // enter
// do your save action
} else if (e.which == 27) { // escape
$('#dg').datagrid('cancelEdit', index)
}
})
}
})
}
})