Re: Cancelling changes on managed objects
Re: Cancelling changes on managed objects
- Subject: Re: Cancelling changes on managed objects
- From: mmalc Crawford <email@hidden>
- Date: Sat, 23 Jun 2007 05:59:12 -0700
On Jun 23, 2007, at 1:23 AM, Eric MORAND wrote:
Is there a simple way to cancel all changes made on a managed
object ? Let's say my user modify a managed object and then click on
a "cancel" button that is supposed to revert the object to its
original state. How am I supposed to implement such a (very common)
feature ?
The managed object context is a "scratch pad".
You can create a new context, fetch the relevant managed object into
it, and constrain the edits to that. You can then discard the edits
and the context if you want, otherwise merge them into the main
context -- see <http://developer.apple.com/documentation/Cocoa/Conceptual/NSPersistentDocumentTutorial/08_CreationSheet/chapter_9_section_1.html
> for the general principles.
mmalc
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden