Allow overriding keydown.enter action when inline editing
- Linguagem predominante
- TypeScript
- Estrelas
- 1.6k
- Forks
- 867
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
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.
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Avaliação
Esta issue ainda não foi avaliada.