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

#891 Add onEditorSubmit and onEditorCancel callbacks for Column & BodyCell #892

Merged
merged 1 commit into from
May 30, 2019

Conversation

TonisPiip
Copy link
Contributor

@TonisPiip TonisPiip commented May 17, 2019

Minor Feature Request.

Added onEditorSubmit onEditorCancel callbacks for Column BodyCell.

Does not disturb any existing logic.

Esc closes editor and calls onCancel, otherwise when switching to ViewMode calls onSubmit.

Studying the existing logic for editorValidatorEvent and editorValidator is odd.
If you tab to the next editable cell, the previous editor will never close. And the behavior, is the same regardless of "click" or "blur", if you click away, it's switched to view via the click event, or blur, which is also triggered at the same point.

Main point is there's no way to trigger a cancel to an edit. The closeEditingCell() in DataTable.js is helpful, but just triggers a close. There's no way for a user to not submit typed data unless you use the editorValidator method to revert the data in the case of invalid data, but that's not good, as that method should be for validation only, not submitting.

Also in the case that you've opened more than one editor via invalid data + tab, you can't edit the previous cell because whenever the grid-data updates it focuses on the last open editor due to:

    componentDidUpdate() {
        if (this.container && this.props.editor) {
            if (this.state.editing) {
                let focusable = DomHandler.findSingle(this.container, 'input');
                if (focusable) {
                    focusable.setAttribute('data-isCellEditing', true);
                    focusable.focus();
                }
                ...

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

Successfully merging this pull request may close these issues.

2 participants