• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CoreData: filtering controller content
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CoreData: filtering controller content


  • Subject: Re: CoreData: filtering controller content
  • From: Scott Stevenson <email@hidden>
  • Date: Sun, 29 May 2005 17:46:03 -0700


On May 28, 2005, at 11:08 AM, Justin Fagnani wrote:

I actually can't even figure out how to filter out the object I'm editing from the list of types. The object is selected in an ArrayController called Types. I want a second ArrayController called ParentTypes to contain all the valid choices for a parent.


It's pretty hard to follow this without seeing how you have things laid out, but I *think* you could do this by implementing a custom method like:

- (NSSet *) parentTypes
{
    return [self valueForKeyPath:@"parent.types"];
}

You could then bind the ParentTypes array controller to the Types array controller, with the "selection" controller key and "parentTypes" as the model key path.

Does that do what you want?


I figure that I could filter the selected object with a predicate of "self != ????" well, what do I put there? Types.selection?


I think I get what you're after at a high level, but I'm not sure how to answer because I can't see how this all fits together. I don't think this is a predicate problem per say; you may just need a different approach.


The predicate builder for fetched requests has a way to place a variable in the predicate, but I can't seem to compare self to a variable.


I'm not sure 'self' would work here.


And the predicate for a controller doesn't have a GUI, so I'm not sure yet how to place a variable.


You can always use Xcode's predicate editor to create a predicate, then just copy and paste it elsewhere.


Even then, how do I set that variable?


You'd set the predicate programatically, not in Interface Builder.


However, for some reason I think of this as really extending the behavior of the controller. I'm tempted to subclass NSTreeController and add methods for retrieving objects along the different axes. Good idea or bad idea?


Not sure exactly what you mean. It doesn't sound like it's in the spirit of Cocoa/MVC design patterns, though.


     - Scott


--

http://theocacao.com/

feed://theocacao.com/index.rss



 _______________________________________________
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

References: 
 >CoreData: filtering controller content (From: Justin Fagnani <email@hidden>)

  • Prev by Date: Re: Monitoring system time
  • Next by Date: Re: Monitoring system time
  • Previous by thread: CoreData: filtering controller content
  • Next by thread: NSMutableArray with NSMutableDictionaries
  • Index(es):
    • Date
    • Thread