Re: Manual Outline View Sorting
Re: Manual Outline View Sorting
- Subject: Re: Manual Outline View Sorting
- From: Thomas Davie <email@hidden>
- Date: Wed, 1 Dec 2004 00:31:32 +0000
On 30 Nov 2004, at 23:40, The Karl Adam wrote:
sortDescriptors are not only useful for bindings, bindings merely save
you the trouble of interacting with them yourself. This is pretty
trivial to accomplish.
A sort descriptor has three components, a selector for performing the
comparison, this is generally -compare:, a sort Order (ascending or
descending), and lastly a key to sort by. The only one that needs to
be explained is the key for sorting and that is merely KVC compliance,
so it will sort your objects according to the order of that instance
variable in your objects.
Then in your Data Source when the user asks for a sort you ask for the
sort descriptors on the Table/OutlineView, and call the correct
-sortUsingDescriptors: method on your internal array or dictionary. IF
you have your own custom storage then it's up to you to decide hwo
your sort happens using the sortDescriptors directly and their
-compareObject:to: method.
Thanks a million – the fact that sortDescriptors did not require you to
bind keys to instance variables was the key piece of information I was
lacking. It works beautifully now.
Thanks loads
Tom Davie
--
Computer Science is as much about computers as astronomy is about
telescopes -- Edsgar Dijkstra
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden