Hello,
Is it possible to implement an edit behavior that automatically commits changes when an input cell loses focus? I have tried to implement this myself, but when manually calling commit the grid appears to discard any changes made. I have simulated this behavior in a JSFiddle which you can find at http://jsfiddle.net/2ga7gm0d/
Is this the wrong way to implement that kind of behavior? Or is there a better, more efficiënt way of achieving the result I am looking for? Maybe a solution that also covers simular functionality of asking the user if he wants to leave the current page if there are uncommited changes in the grid?
Kind Regards
Hello Michael,
Thank you for posting in the community.
By design, if you have autmCommit set to true and editMode is set to cell the grid will commit the changes automatically. If you comment the code that handles the blur event for the editor your sample it works as expected.
The modified sample could be found at: http://jsfiddle.net/2ga7gm0d/1/
If this is not an accurate demonstration of what you are trying to achieve please feel free to modify it and send it back to me with more clarifications of what you are trying to achieve.
I hope you find this information helpful.
Please let me know if you have any additional questions regarding this matter.
Vasya,
I think you misunderstood my intention! The blur handler was there to make sure that when the user clicks out of the cell he was editing, the grid automatically commits any changes made. (if no invalid input was present in the cell) I know the autoComplete setting partially fulfills my needs, because it makes sure any changes made will be saved automatically when I enter another cell or tab, but I want the same behavior when he clicks on another element. (!= the grid) As you can see in my original JSFiddle when you edit a cell and then click out of the grid, I try to invoke this behavior by manually calling commit, but the grid appears to rollback my changes.
Calling commit manually in the context of the blur event would revert the changes because they are not yet accepted by the grid as part of ending the edit mode for that cell. The Updating feature has a public function "endEdit" that should help you achieve your scenario. Could you please try the modified fiddle http://jsfiddle.net/2ga7gm0d/2/ and see if it fulfills your requirements?
Best regards,
Stamen Stoychev
Yes this works perfectly, thank you!
I am glad that you find Stamen`s suggestion helpful for achieving your requirement.
Please let me know if you need any further assistance with this matter.
Hello Vasya,
Upon entering testing for this feature we have noticed that pressing 'TAB' to navigate between editable cells does not work anymore. This is caused by the implemented blur handler. However, the arrow key navigation functionality (gained by setting the 'ExcelNavigationMode' property to 'true' of the IgGridUpdating feature) is not affected by this handler. Is there any way to force the grid to tab to the next cell (like when using the arrow keys) while the previous solution (blur handler) still remains?