Re: Table view active sorting and filter as model changes...
Re: Table view active sorting and filter as model changes...
- Subject: Re: Table view active sorting and filter as model changes...
- From: "Shawn Erickson" <email@hidden>
- Date: Wed, 23 May 2007 16:25:07 -0700
On 5/23/07, mmalc Crawford <email@hidden> wrote:
On May 23, 2007, at 2:03 PM, Shawn Erickson wrote:
> ...or as you state I could iterate over all participants and observe
> the key(s) that are currently in the active sort descriptor.
>
That's not *quite* what I was saying...
(The hint was supposed to be that the array controller already
observes all the elements.)
> Thinking a little more about it... subclassing NSArrayController may
> be the better way to go.
>
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object
change:(NSDictionary *)change context:(void *)context
{
[super observeValueForKeyPath:keyPath ofObject:object change:change
context:context];
if ([keyPath isEqualToString:FilterOrSortKey])
{
[self rearrangeObjects];
}
}
Ah based on logging output I have in my participant class (implemented
addObserver:forKeyPath:...) I didn't see that the array control was
observing the collection of objects that it manages. After trying out
the above it does apparently observe all keys (or some type of
wildcard keypath?).
So now I am curious on how an NSArrayController observes the objects
it works with... any hints on that?
Thanks for the help I think I have a workable solution now.
-Shawn
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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