• 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: NSArrayController & NSTreeController default sort order
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArrayController & NSTreeController default sort order


  • Subject: Re: NSArrayController & NSTreeController default sort order
  • From: "I. Savant" <email@hidden>
  • Date: Tue, 22 Jan 2008 14:09:05 -0500

On Jan 22, 2008 2:06 PM, I. Savant <email@hidden> wrote:
> > > How do I set up the bindings correct
> > > so my controllers fetch the data pre-sorted?
> >
> > Subclass your controller and override -arrangeObjects:.
>
>   Um ... or, you could use the controller's -setSortDescriptors:
> method or its sortDescriptors binding since they're there for just
> that purpose.

  Addendum: Of course if you're using Core Data, you need to be aware
that there's no pre-determined order in which you'll receive members
of a fetch (which is the case with your controller). You'd need to add
a sortable attribute to your entity like, "sortOrder" and assign each
instance a sane value. You'd use that key when setting your
controller's sort descriptors.

--
I.S.
_______________________________________________

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: NSArrayController & NSTreeController default sort order
      • From: Chris Schmitt <email@hidden>
References: 
 >NSArrayController & NSTreeController default sort order (From: Chris Schmitt <email@hidden>)
 >Re: NSArrayController & NSTreeController default sort order (From: "Kyle Sluder" <email@hidden>)
 >Re: NSArrayController & NSTreeController default sort order (From: "I. Savant" <email@hidden>)

  • Prev by Date: FSPathCopyObjectAsync Help
  • Next by Date: Making a NSPanel immovable
  • Previous by thread: Re: NSArrayController & NSTreeController default sort order
  • Next by thread: Re: NSArrayController & NSTreeController default sort order
  • Index(es):
    • Date
    • Thread