• 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: programmatically sorting an NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: programmatically sorting an NSTableView


  • Subject: Re: programmatically sorting an NSTableView
  • From: James Walker <email@hidden>
  • Date: Tue, 12 Jul 2011 19:24:19 -0700

On 7/12/2011 6:14 PM, Ken Thomases wrote:
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.

The table column is bound to the array controller using IB. I was adding new items using -[NSArrayController addObject:]. What's the better way?


Regards,
--
  James W. Walker, Innoventive Software LLC
  <http://www.frameforge3d.com/>
_______________________________________________

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: programmatically sorting an NSTableView
      • From: Ken Thomases <email@hidden>
References: 
 >programmatically sorting an NSTableView (From: James Walker <email@hidden>)
 >Re: programmatically sorting an NSTableView (From: Peter <email@hidden>)
 >Re: programmatically sorting an NSTableView (From: James Walker <email@hidden>)
 >Re: programmatically sorting an NSTableView (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: programmatically sorting an NSTableView
  • Next by Date: Re: iOS: Differentiating between 1 or 2 finger touches
  • Previous by thread: Re: programmatically sorting an NSTableView
  • Next by thread: Re: programmatically sorting an NSTableView
  • Index(es):
    • Date
    • Thread