Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow overriding keydown.enter action when inline editing #981

Open
myleshk opened this issue Mar 27, 2019 · 0 comments
Open

Allow overriding keydown.enter action when inline editing #981

myleshk opened this issue Mar 27, 2019 · 0 comments

Comments

@myleshk
Copy link

myleshk commented Mar 27, 2019

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:

(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, 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.

@myleshk myleshk changed the title Config keydown.enter action when editing Allow overriding keydown.enter action when inline editing Mar 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant