akveo / akveo/ng2-smart-table

Allow overriding keydown.enter action when inline editing

未关闭
#981 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
1.6k
派生
867
PR 合并指标
30 天内没有已合并 PR

描述

When input editor.type is "input" or "textarea", ENTER key will trigger saving, and such behavior is hard-coded in [src/ng2-smart-table/components/cell/cell-editors/input-editor.component.ts](https://github.com/akveo/ng2-smart-table/blob/53ea3a9c3229400a9bfcc64665298d543e0c27d2/src/ng2-smart-table/components/cell/cell-editors/input-editor.component.ts#L16):
```
(keydown.enter)="onEdited.emit($event)"
```
This variable `$event` is passed all the way up, not exposed or processed but discarded at [src/ng2-smart-table/components/cell/cell.component.ts](https://github.com/akveo/ng2-smart-table/blob/53ea3a9c3229400a9bfcc64665298d543e0c27d2/src/ng2-smart-table/components/cell/cell.component.ts#L31), so we cannot change this behavior:
```
onEdited(event: any) {
if (this.isNew) {
this.grid.create(this.grid.getNewRow(), this.createConfirm);
} else {
this.grid.save(this.row, this.editConfirm);
}
}
```

This is a problem in the following situations:

* When typing non-alphabetic languages like Chinese, ENTER key can be part of the typing process (e.g. charactor selection). If this happens, inputing process is interupted and intermediate content saved unwantedly.

* In textarea mode, it is likely that you want to input multiline text. Then when you try to break a line by pressing ENTER key, it will save instead, also unwantedly.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。