OK. It’s been a long crappy day. I’ve been working with the DataGrid’s “edit” events, such as OnEditing, OnEditingRow, OnEdited, and OnEditedRow with inline editing. I have a few fields on the grid that are editable and others that are not. Here’s what sucks.
- The “editing” events fire whever the cell’s editor is activated – regardless of the value being changed or not.
I worked around this one by adding a variable with script level scope to save the value from the “editing“ event (which gives you the current value) and then comparing the value passed to the “edited“ event (which gives you the new value). If the values are the same then I didn’t do anything (ie: the cell’s editor was activated but the value did not change)
- The “editing“ events fire for cells that have the editor disabled, which makes absolutely no sense.
This was worked around essentially by the fix above. Since the cell’s editor was disabled, obviously the value would not have changed.
- The “edited“ (past tense) events imply that the record has already been edited (ie: change committed to the database), but this is not the case.
This can be worked around by calling the grid’s Refresh method prior to doing any work in the event handler. This will cause all updated data to be written out to the database and you can drive on as normal.
All in all, a sucky day. Just thought I’d share my findings to save anyone else some grief.