Re: Creating an ordered list for combo-box content from a Core Data entity attribute
Re: Creating an ordered list for combo-box content from a Core Data entity attribute
- Subject: Re: Creating an ordered list for combo-box content from a Core Data entity attribute
- From: "I. Savant" <email@hidden>
- Date: Wed, 8 Apr 2009 17:02:41 -0400
On Wed, Apr 8, 2009 at 4:05 PM, Jon C. Munson II <email@hidden> wrote:
> I have a combo-box whose content needs to be the aggregated values of the
> attribute it is bound to. Ideally, I'd like this sorted.
>
> Binding content/content values to @distinctUnionOfObjets.attribute yields an
> unordered list - not quite so friendly.
Yes, this is a FAQ. Since Core Data deals in sets (NSSet /
NSMutableSet - by definition, unordered), you have to sort the list by
some attribute. Either an alphanumeric sort or if you want to allow
designation of an arbitrary order, you'll want to create a "sortOrder"
attribute.
> So, I've created a relevant method to fetch & load an ordered list.
>
> Now, I'd like to monitor that attribute for any change so I can re-load my
> list.
What kind of attribute is it? It should be as easy as setting the
desired sort descriptors (see NSSortDescriptor and associated
companion guide(s)) on the array controller that's providing your
list.
--
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