Core Data + NSOutlineView + Sorting without NSTreeController
Core Data + NSOutlineView + Sorting without NSTreeController
- Subject: Core Data + NSOutlineView + Sorting without NSTreeController
- From: Seth Willits <email@hidden>
- Date: Sat, 7 Jul 2007 15:48:36 -0700
(I couldn't come up with a decent short-and-easy-to-understand
subject for this email that was really accurate, but hopefully
that'll do.)
I've ditched using NSTreeController for a few reasons, so I'm back to
using the data source methods to display my objects from Core Data.
The question I have is about how best to keep an array of arranged
objects (according to a sort descriptor). Before Core Data I had a
mutable array for my children, so they were always implicitly
ordered, and whenever the sort descriptor changed, I would just
resort the array. (They only every showed up in one place, so there
was never an instance of them needing to be simultaneously sorted in
different ways.)
But how should I do this with Core Data? Given that to-many
relationships are sets, I'm wondering if I should do a similar thing
and keep a sorted array as an instance variable in my NSManagedObject
subclass and recreate and resort the array every time the objects on
the many side of the relationship change. It would _work_ but it just
seems so inefficient.
Do any of you have a clever solution as to where should I store the
sorted array and when I should sort it?
Thanks,
--
Seth Willits
_______________________________________________
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