Re: programmatically sorting an NSTableView
Re: programmatically sorting an NSTableView
- Subject: Re: programmatically sorting an NSTableView
- From: Ken Thomases <email@hidden>
- Date: Tue, 12 Jul 2011 20:14:08 -0500
On Jul 12, 2011, at 5:36 PM, James Walker wrote:
> On 7/12/2011 2:04 PM, Ken Thomases wrote:
>
>> Invoking -setSortDescriptors: on the array controller does sort it (or should).
>> Back on 10.4, it may have been necessary to follow that with a call to -rearrangeObjects.
>
> -[NSArrayController setSortDescriptors:] alone doesn't work for me even on 10.6, but that combined with -[NSArrayController rearrangeObjects] does the trick. That is, I set use setSortDescriptors: once, and use rearrangeObjects whenever I add new items to the table.
Is your array controller bound to its content, or are you setting that programmatically? If it's bound, then it ought to rearrange its objects when they are added. The fact that it doesn't suggests that you aren't updating the property to which it is bound in a KVO-compliant manner.
Regards,
Ken
_______________________________________________
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