Re: Disabling sorting in NSTableView
Re: Disabling sorting in NSTableView
- Subject: Re: Disabling sorting in NSTableView
- From: James Dempsey <email@hidden>
- Date: Tue, 11 Nov 2003 18:51:45 -0800
Brian,
The first part is a how to that should get you going - followed by a
bit of explanation.
You need to do the following:
The How:
Select the table view itself and inspect its bindings.
You will see three Table Content bindings for the table view:
content
selectionIndexes
sortDescriptors
Bind the content to:
Bind To: Your Array Controller
Controller Key: arrangedObjects
Model Key Path: <leave this blank>
Bind the selectionIndexes to:
Bind To: Your Array Controller
Controller Key: selectionIndexes
Model Key Path: <leave this blank>
Leave sortDescriptors unbound
A little of what's going on:
Typically you only need to bind each table column value binding to the
arranged objects of an array controller. When you do this, behind the
scenes, all three table view content bindings are automatically 'hooked
up' for you.
It is only when you need to change these three default content bindings
that you need to visit the table view's bindings.
You can also use this mechanism to do other things with a table view's
bindings (like pull the selection indexes from one array controller,
while displaying the arranged objects of another array controller). I
don't have a particularly good use for that in mind at the moment.
Hope this helps.
-James
---------------------------
James Dempsey
Operations Engineer
Apple Software Customer Seeding
Apple Software Engineering
email@hidden
On Nov 11, 2003, at 1:55 PM, Brian Webster wrote:
>
I have an NSTableView in a pretty straightforward configuration with
>
an NSArrayController, with the table columns bound to various
>
properties of the arrangedObjects key of the controller. My table
>
columns are set up so that they have no identifier and no sort key,
>
but when I click on one of the column headers in my app, it still
>
sorts the table by the key being used to retrieve the values for the
>
table. I also unchecked the "Editable" checkbox for each column, and
>
I even programatically set the sortDescriptorPrototype for each column
>
to nil, but it still sorts the columns when I click on the headers.
>
How can I completely disable sorting for this table view while using
>
NSController?
>
>
--
>
Brian Webster
>
email@hidden
>
http://homepage.mac.com/bwebster
>
_______________________________________________
>
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.
_______________________________________________
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.