DataGrid Edit Events Madness

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.

ABOUT THE AUTHOR

Ryan Farley

Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix, now Infor CRM, since 2001 and believes in sharing with the community. His new passion for CRM is Creatio, formerly bpm'online. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

1 Comment

  1. Ryan,

    I’ve been struggling for the past few hours to find a way to update a cell in a datagrid when another has changed. When the Status column is changed I’d like to update the Status Date automatically.

    I’m working with the grid’s EDITED and EDITING events. The EDITING updates a global variable which holds the value of the field that was changed.

    The EDITED event tests to see if the Status column was changed and then updates the Status Date column for the current row.

    The problem is, I can’t figure out how to update the Status Date column w/o using to the old Recordset method. The RS method doesn’t seem to work in this case; the values don’t stick and the parent/child relationship (this is a child grid) is blown.

    Any ideas?

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!