• 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: Core Data + NSOutlineView + Sorting without NSTreeController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data + NSOutlineView + Sorting without NSTreeController


  • Subject: Re: Core Data + NSOutlineView + Sorting without NSTreeController
  • From: Conor <email@hidden>
  • Date: Sun, 08 Jul 2007 16:50:03 +0200

Hi Seth,

I would add a NSNumber position attribute to your objects and use that to
sort. You would have to change the numbers for all objects higher than where
you insert a new object, but it's no different than having to recreate your
array. I suggest this solution not because I know but because it's what I
would do rather keep a separate sorted array for each set of children.

Regards,
Conor
http://www.bruji.com/

> (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?


_______________________________________________

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: Core Data + NSOutlineView + Sorting without NSTreeController
      • From: Seth Willits <email@hidden>
  • Prev by Date: Re: [coredata] populate NSPopupButton with NSAttributedStrings
  • Next by Date: UTF-8 string encoding bug in stringWithContentsOfURL?
  • Previous by thread: Core Data + NSOutlineView + Sorting without NSTreeController
  • Next by thread: Re: Core Data + NSOutlineView + Sorting without NSTreeController
  • Index(es):
    • Date
    • Thread