NotApplicable marker with display pattern

Posted by Jeff Barger on Stack Overflow See other posts from Stack Overflow or by Jeff Barger
Published on 2010-05-27T18:32:04Z Indexed on 2010/05/28 23:52 UTC
Read the original article Hit count: 204

Filed under:
|

Ok, so I'm pretty new to Cocoa, especially Bindings, but here's what I'm trying to do. I've got a Core Data model consisting of two entities: Category and Item. Category has a to-many relationship to Item called children, and Item has a relationship to Category called parent. Item has two attributes that Category does not have: quantity and desiredQuantity. What I'd like to do is display the tree in an NSOutlineView with two columns. One column is bound to the name of either the Category or the Item. I want to the second column to display something along the lines of

2 of 5

for the Item rows and nothing at all for the Category rows. When I use a display pattern, the Category rows end up showing

of

I noticed that if I don't use a display pattern for the second column, and instead just bind its Value to either the quantity or the desiredQuantity, the Category rows show nothing; its only if I try to use the display pattern.

How can I make it display nothing for the Category rows and still use the display pattern? Or can I?

Edit: I guess I didn't explain what the NotApplicable marker has to do with anything - Category does have properties for quantity and desiredQuantity, but they just return NSNotApplicableMarker.

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about cocoa-bindings