Maybe this is not a good idea. What if you are editing a string field, this would mean that you would commit to the database on every character you type.
You could submit this as an idea. See also https://forum.mendix.com/link/questions/91638 for other datagrid related functionality improvements...
How are you editing the records now? Are you opening a pop up or separate page with a dataview? If so, you can try setting your columns in your datagrid to be editable.
Hope this helps!
Edit: You can try using a listview instead of a dataview. You can use a layout grid to make it look similar to a datagrid.
I show you by a picture in order to be the clearest possible.
It is when I fill the last field "Country" and I click on save, the country that I filled is not saved because I have to click somewhere else in order for it to be save before submitting my form by clicking on save button.
I'm assuming the issue here is that the focus isn't removed from the data grid field before the data is saved and the page closed. So, here's something to try.
This should set the focus to your button (away from your field), then fire the save action.
Let us know if it works!