Re: NSOutlineView column sorting
Re: NSOutlineView column sorting
- Subject: Re: NSOutlineView column sorting
- From: Itrat Khan <email@hidden>
- Date: Sun, 7 Jul 2002 16:44:57 -0400
On Sunday, July 7, 2002, at 01:49 PM, fritx wrote:
I've looked in the docs but I can't find any info on sorting content by
clicking in the column header in an NSOutlineView (or NSTableView for
that matter). I'd also like to know how the sort direction triangle is
handled.
Can anyone point me at some example code or the relevant spot in the
docs?
Sorting is specific to an application's data model, which is probably
why the docs don't cover it (though a few sorting recipes would be a
nice addition).
Generally, you implement sorting in your table's data source. If your
data source is relatively small, implementing
outlineView:numberOfChildrenOfItem: so that it returns a sorted result
might be adequate; with a large data source, you'll need to consider a
more efficient mechanism, such as having the data source cache a local
copy of the array and synchronise itself with changes in the model. I
would discourage from sorting the model directly because it prevents two
views from sorting the same data on different keys.
As for the table indicators, there's a brief example in the Cocoa-Dev
archives. Look for _defaultTableHeaderSortImage in the following pages:
http://lists.apple.com/archives/cocoa-dev/2001/Sep/8.html
http://lists.apple.com/archives/cocoa-dev/2001/Dec/1.html
Regards,
Itrat.
............................................................
Modeless Software, Inc.
London, Ontario (Canada)
Tel: +1 519 473 2037
Web: www.modeless.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.