tags:

views:

81

answers:

1

I have a DataGrid of objects, and I want to modally edit them; pop up a dialog, change the item, and if the user clicks "Ok", save the changes back to the original item, and if they click "Cancel", do nothing. It seems obvious that if I simply pass in a reference to the original object and change it using data bindings to the fields in the edit form, I won't be able to cancel my edits. How can I support that capability?

A: 

I ended up implementing this by copying all of the fields from the value object into the edit components, rather than data binding them. Then, on save, I copy them back to the value object. It's a bit verbose, so I'd love to find out that there's a better way.

Chris R