• 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: NSOutlineView column sorting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >NSOutlineView column sorting (From: fritx <email@hidden>)

  • Prev by Date: Re: Screen saver and preview crashing
  • Next by Date: Question about HTML and TextView/Field
  • Previous by thread: NSOutlineView column sorting
  • Next by thread: Fwd: Apr Dev Tools: Run session aborted: No launchable executable present to run
  • Index(es):
    • Date
    • Thread