On 2011 Jan 10, at 21:39, Graham Cox wrote:

> As suggested, to undo a sort, pass the old descriptors to the undo manager 
> and when undo is invoked, it restores the old descriptors and once again 
> invalidates the cache.

But that assumes that the data was sorted with some old descriptors to begin 
with.  It seems like this would not work if the objects had been manually 
arranged into some arbitrary order by the user.

------

Aside: Reading this thread really makes one appreciate Core Data.

I've written a Core Data app which can Undo Sort.  The sortable objects are the 
'many' members of to-many relationships.  Each one has an 'index' parameter, 
which is re-set during sorting.  When you 'Undo Sort', all of the 'index' 
parameters get set back to their original values.  There is no code to 'Undo 
Sort' or 'Redo Sort'.  It really is "for free" (well, after you've tamed Core 
Data's Undo Groupings).

I should not discourage John from doing it the hard way first, though.  The 
usual warning against Cocoa beginners diving into Core Data applies :)

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to