You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Short description
I noticed that my grid would enter a state where double clicking an editable cell would no longer enter into editing mode on that cell. Such edits had been working just moments earlier in the same browser window.
Steps to reproduce or sample
This situation comes about when I try to arrange for edits to a cell to be submitted immediately back to the server. I do this by placing a call to the grid's save method within an event handler for the grid's change event.
It seems that what happens is that the save request is sent to the server, and then the selection moves to the next cell in the column. So far so good.
When the save request completes, the grid then refreshes itself. As part of this, a refreshBody method is called, which replaces the HTML for the grid body, and we thereby lose the input element that had been present for editing. However, although this element goes away, grid.last.inEditMode remains set to true. When, therefore, editField is called again in response to a double click, after checking this flag, it appears to the implementation as though editing is already underway, and it does not create a new input element for editing whichever cell was just double clicked.
This, at least, is what my time spent with the debugger seemed to reveal to me.
It seems to me there's a bug here, although I know it's also possible I'm misusing the API in some way.
As a side note, I'd be happy to keep the edit cursor from automatically advancing to the next cell in the column, since that doesn't really suit my use case anyway. That should have the happy side effect of keeping this problem from manifesting for me.
The text was updated successfully, but these errors were encountered:
I was wondering why I didn't end up in this situation if I invoked save in response to a button click.
It seems that the blur handler on line 2956 in w2grid.js (and in comparable places on other switch branches) is ordinarily used to remove the input element and reset the internal state, including the inEditMode flag. However, this handler isn't invoked when the body HTML is replaced, as it is in the sequence of events described above.
The PR that adds editAutoAdvance allows me to avoid ending up in the situation where the identified problem manifests, and this is fine in my use case, since I would prefer not to have the auto-advance behavior anyway.
However, this doesn't address the problem itself, I don't think. That is, if I have a call to the grid's save method in a change event handler, andeditAutoAdvance has not been disabled, then the grid ends up in a state where no further inline edits can be made until the page is refreshed, for reasons I tried to outline above.
Short description
I noticed that my grid would enter a state where double clicking an editable cell would no longer enter into editing mode on that cell. Such edits had been working just moments earlier in the same browser window.
Steps to reproduce or sample
This situation comes about when I try to arrange for edits to a cell to be submitted immediately back to the server. I do this by placing a call to the grid's
save
method within an event handler for the grid'schange
event.It seems that what happens is that the save request is sent to the server, and then the selection moves to the next cell in the column. So far so good.
When the save request completes, the grid then refreshes itself. As part of this, a
refreshBody
method is called, which replaces the HTML for the grid body, and we thereby lose theinput
element that had been present for editing. However, although this element goes away,grid.last.inEditMode
remains set to true. When, therefore,editField
is called again in response to a double click, after checking this flag, it appears to the implementation as though editing is already underway, and it does not create a newinput
element for editing whichever cell was just double clicked.This, at least, is what my time spent with the debugger seemed to reveal to me.
It seems to me there's a bug here, although I know it's also possible I'm misusing the API in some way.
As a side note, I'd be happy to keep the edit cursor from automatically advancing to the next cell in the column, since that doesn't really suit my use case anyway. That should have the happy side effect of keeping this problem from manifesting for me.
The text was updated successfully, but these errors were encountered: