Re: Manual Outline View Sorting
Re: Manual Outline View Sorting
- Subject: Re: Manual Outline View Sorting
- From: The Karl Adam <email@hidden>
- Date: Tue, 30 Nov 2004 18:40:02 -0500
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.
-Karl
On Tue, 30 Nov 2004 22:54:51 +0000, Thomas Davie <email@hidden> wrote:
> Hi,
> My data structure that I am displaying in an outline view is too
> complex to use the standard bindings approach to filling out the data.
> So I'm using an NSOutlineViewDataSource... My problem is allowing the
> user to sort the data – I can't manage to get the table view to allow
> the user to select a column to sort on – unless I fill in any values in
> the sordDescriptors boxes (only useful if you're using bindings) the
> outline view does not allow this behaviour and selectedColumn and
> highlightedTableColumn both return useless values (-1 and nil
> respectively).
>
> Any hep appreciated
>
> Bob
>
> --
> What is the internet?
> It's the largest equivalence class in the reflexive transitive
> symmetric closure of the relationship "can be reached by an IP packet
> from". -- Seth Breidbart
>
> _______________________________________________
> 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
>
_______________________________________________
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