change notification for dependent key between classes?
change notification for dependent key between classes?
- Subject: change notification for dependent key between classes?
- From: Alexander Lamb <email@hidden>
- Date: Mon, 12 Jun 2006 15:42:54 +0200
Hello list,
I have a very simple model:
projects have many tasks
each task has one person (the owner of the task).
So in reverse, people have many tasks.
Basically, it is a many to many between projects and people with
tasks in the middle.
Now, the problem:
I want to have the list of people on a project. To do so, I
implemented in my project class:
- (NSSet *)peopleOnProject
{
return [self valueForKeyPath:@"email@hidden"];
}
This works fine.
In order to have peopleOnProject change notify my bindings, I added
in my project class:
+ (void)initialize
{
[self setKeys:[NSArray arrayWithObjects:@"tasks",nil]
triggerChangeNotificationsForDependentKey:@"peopleOnProject"];
}
So this works fine when I add or remove tasks to a project, the
"peopleOnProject" will be recalculated (and displayed).
Now, what if for a given task I change the owner. The "tasks"
attribute has not been changed to peopleOnProject will not trigger a
change.
Is there a simple way for doing a
triggerChangeNotificationForDependentKey on an attribute of a second
class?
Thanks,
Alex
--
Alexander Lamb
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