Skip to content
This repository has been archived by the owner on Apr 2, 2019. It is now read-only.

exitEditMode getting called twice on move command #177

Merged
merged 1 commit into from
May 15, 2013

Conversation

gbedardsice
Copy link
Contributor

When using move commands (tab, arrows, etc.), the exitEditMode method of the editor is being called twice. You can see the error here by simply using a move command.

The reason is, here, when you call enterEditMode, the postRender method of the new cell editor calls focus on the new editor element, which results in a blur event on the old editor. The saveOrCancel method is then called again on the old editor, and then triggers the backgrid:edited event a second time.

You can resolve this simply by moving this line before the if block, to make sure that the old editor is actually removed before entering in the new editor.

…d editor before enterEditMode of new editor to keep exitEditMode from being called twice
@fusioned
Copy link

I was about to post the same bug issue as it was replicable in the first example on the backgridjs.com home page, but gbedardsice has this explained more succinctly than I would.

The 1st call to exitEditMode is around 28 calls deep from the initial event, which implies this is a side effect, whilst the 2nd call, which I presume is the intended action, happens 10 calls deep in the stack .
.

@wyuenho
Copy link
Contributor

wyuenho commented May 14, 2013

Thanks for reporting this. Free feel to send me a PR.

@gbedardsice
Copy link
Contributor Author

Oops, I always forget this.

wyuenho added a commit that referenced this pull request May 15, 2013
exitEditMode no longer gets called on move command
@wyuenho wyuenho merged commit 31ef0e9 into cloudflarearchive:master May 15, 2013
@wyuenho
Copy link
Contributor

wyuenho commented May 15, 2013

Thank you.

@wyuenho wyuenho mentioned this pull request May 15, 2013
wyuenho added a commit that referenced this pull request Aug 14, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants