On 14 Dec 2009, at 18:09, Graham Cox wrote: > > On 14/12/2009, at 10:00 PM, Graham Cox wrote: > >> >> On 14/12/2009, at 9:56 PM, Gerriet M. Denkmann wrote: >> >>> I have an NSTableView with just one column, filled by some >>> NSArrayController. >>> >>> Initially the items are not in any recognizable order. >>> When I click on the NSTableHeaderView a triangle appears and now the items >>> are nicely sorted. >>> >>> Is it possible (either in InterfaceBuilder or programmatically) to make the >>> NSTableColumn start with this sorted behaviour? >> >> >> In your -awakeFromNib method, pass the sortDescriptors from the table view >> to the array controller. > > > I think I got that wrong - this is what I do (for example) in most of my > table views to establish an initial sorting. With NSArrayController, I'm not > sure if you need to explicitly pass the sortDescriptors also to that or > whether it gets them anyway through bindings. > > NSTableColumn* col = [mMetaTableView tableColumnWithIdentifier:@"key"]; > [mMetaTableView setSortDescriptors:[NSArray arrayWithObject:[col > sortDescriptorPrototype]]];
I added your code into windowControllerDidLoadNib: and it works perfectly. Thank you very much! I would never come up with this idea on my own. Kind regards, Gerriet. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com