Re: NSTableView auto sorting does not work
Re: NSTableView auto sorting does not work
- Subject: Re: NSTableView auto sorting does not work
- From: Chris Tracewell <email@hidden>
- Date: Mon, 14 Feb 2011 11:17:38 -0800
> On Fri, Feb 11, 2011 at 5:14 PM, Chris Tracewell <email@hidden> wrote:
>> I have experienced that an NSTableview which is bound to an array controller will sometimes automatically sort when their column headers are clicked and sometimes not. As an example, I currently have two windows, each with a tableview bound to an array controller. One tableview sorts, the other does not. For both tableviews each column is bound to the arranged objects of its respective array controller and has "Creates Sort Descriptor" selected in IB.Yes, I could use delegates and implement my own sort descriptors but getting free sorting is really nice and it works for some of my tableviews, so I'd like to find out what breaks this functionality.
>
I got this to work. I noticed in Tableview 1 that I never bound its content or selectionindexes to the array controller, only the actual columns were bound and automatic sorting worked. In tableview 2 I had those two properties bound and when I unbound them automagic sorting began working. I assume that since I had set the selectionIndexes and content properties of the tableview the automagic sortDescriptor creation and binding assumed I was taking over and stopped doing their thing. Also worthy of noting is that binding using display patterns on tv columns will also break auto sorting. That was fine for me as it made sense to provide a property via my model anyway.
I would really appreciate anyone pointing me to docs that explain this if it exists so I can be confident in my assumptions.
--Chris_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden