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

fix: we shouldn't always commit on focusout/blur #332

Merged
merged 2 commits into from
May 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 1 addition & 23 deletions src/slickgrid-react/components/slickgrid-react.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -712,28 +712,6 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
}
}

/**
* Commits the current edit to the grid
*/
commitEdit(target: Element) {
if (this.grid.getOptions().autoCommitEdit) {
const activeNode = this.grid.getActiveCellNode();

// a timeout must be set or this could come into conflict when slickgrid
// tries to commit the edit when going from one editor to another on the grid
// through the click event. If the timeout was not here it would
// try to commit/destroy the twice, which would throw an
// error about the element not being in the DOM
setTimeout(() => {
// make sure the target is the active editor so we do not
// commit prematurely
if (activeNode?.contains(target) && this.grid.getEditorLock().isActive() && !target?.classList?.contains('autocomplete')) {
this.grid.getEditorLock().commitCurrentEdit();
}
});
}
}

/**
* Define our internal Post Process callback, it will execute internally after we get back result from the Process backend call
* For now, this is GraphQL Service ONLY feature and it will basically
Expand Down Expand Up @@ -1574,7 +1552,7 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
{/* <!-- Header slot if you need to create a complex custom header --> */}
{this.props.header && <div className="header">{this.props.header}</div>}

<div id={`${this.props.gridId}`} className="slickgrid-container" onBlur={$event => this.commitEdit($event.target)}>
<div id={`${this.props.gridId}`} className="slickgrid-container">
</div>

{/* <!--Footer slot if you need to create a complex custom footer-- > */}
Expand Down
Loading