NSArrayController Mysteries: Proxy Sorting in Tiger
NSArrayController Mysteries: Proxy Sorting in Tiger
- Subject: NSArrayController Mysteries: Proxy Sorting in Tiger
- From: BlueHorseshoe <email@hidden>
- Date: Sat, 28 May 2005 21:04:43 -0400
This issue has to with binding a "model" NSMutableArray as the
"contentArray" of an NSArrayController that is set as the
"dataSource" of an NSTableView. I moved my application to Tiger and
changed from using a KVC-proxy array to binding directly, and now my
application sorting the underlying "model" array whereas it use to
only sort a "proxy" array internal to NSArrayController. I am trying
to understand what specifically caused the change in sorting behavior.
In Panther (OS X 10.3), when one simply clicedk on the
NSTableHeaderCell's to the activate the default sorting capacity, the
"model" NSMutableArray itself was _not_ sorted, while the internal
proxy array of the NSArrayController was instead sorted and
displayed. If you do not understand what I am talking about here,
see the two quotes from the archives which describe this phenomenon
that are copied below.
Has this behavior changed in Tiger (OS X 10.4)? That is, does the
actual underlying "model" NSMutableArray now get sorted with the
default sorting mechanism in place between NSTableView and
NSArrayController?
Or does this "proxy" sorting phenomenon only occur when binding a KVC-
proxy NSMutableArray to the NSArrayController? I mean that, if one
binds directly to the actual "model" NSMutableArray itself, instead
of a proxy created via KVC-compliant accessor methods, does the
"model" itself get sorted? Likewise, in the case of binding
directly to the actual "model" array does NSArrayController still
create an internal working copy of the array?
Truly yours,
Gordon G.
"Question 2 is: when the user sorts the table, what is normally
sorted? It
looks to me like what is being sorted is the array inside the
NSArrayController, but *not* the ultimate array to which its
contentArray is
bound. This is part of why I want to take charge of sorting: I want
to sort
the "urls" array too, so that everything stays in synch. m."
http://www.cocoabuilder.com/archive/message/2004/9/3/116600
"I'm still playing around with bindings and tables. Everything is coming
together pretty well. Now I'm looking into sorting. I know the table
view, that
is bound to an NSArrayController (whose contantArray is bound to my own
NSMutableArray)) will sort when you click on the table heading. I
also realized
that doing that does not sort the actual array.
In trying to figure out what to do if I wanted to sort the actual
array, I did
some tests..
I created a button in the window to actually sort the array. I
display the
contents before and after the sort, but it isn't being sorted! This
is the action
method of the button:"
http://www.cocoabuilder.com/archive/message/cocoa/2004/7/26/112784
_______________________________________________
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