From 5d064fae31fa5ddddf62c60553fdb9d9dad426f5 Mon Sep 17 00:00:00 2001 From: tobiu Date: Mon, 16 Dec 2024 17:34:05 +0100 Subject: [PATCH] #6139table.plugin.CellEditing: onEditorKeyEnter() --- src/table/plugin/CellEditing.mjs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/table/plugin/CellEditing.mjs b/src/table/plugin/CellEditing.mjs index 87564b451..4d8a9a552 100644 --- a/src/table/plugin/CellEditing.mjs +++ b/src/table/plugin/CellEditing.mjs @@ -54,13 +54,23 @@ class CellEditing extends Plugin { me.editors[dataField] = editor = Neo.create({ module : TextField, appName : me.appName, + dataField, hideLabel: true, parentId : view.id, + record, value : record[dataField], - windowId : me.windowId + windowId : me.windowId, + + keys: { + Enter: me.onEditorKeyEnter.bind(me) + } }) } else { - editor.setSilent({value: record[dataField]}) + editor.setSilent({ + dataField, + record, + value: record[dataField] + }) } cellNode.cn = [editor.createVdomReference()]; @@ -72,6 +82,17 @@ class CellEditing extends Plugin { editor.focus() }) } + + /** + * + * @param {Object} path + * @param {Neo.form.field.Base} field + */ + onEditorKeyEnter(path, field) { + if (field.isValid()) { + field.record[field.dataField] = field.value + } + } } export default Neo.setupClass(CellEditing);