• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cancelling changes on managed objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Cancelling changes on managed objects
      • From: Eric MORAND <email@hidden>
References: 
 >Cancelling changes on managed objects (From: Eric MORAND <email@hidden>)

  • Prev by Date: Open specific file types with cocoa app (from Finder)
  • Next by Date: Re: Open specific file types with cocoa app (from Finder)
  • Previous by thread: Cancelling changes on managed objects
  • Next by thread: Re: Cancelling changes on managed objects
  • Index(es):
    • Date
    • Thread