开发者

Calling on a property of an entity's parent in a relationship

开发者 https://www.devze.com 2023-02-13 01:44 出处:网络
I have an NSColumnItem Selected Value bound to a relationship property (jobParent) in an entity (jobs). This is an inverse relationship to a property (projectChild) in a separate entity (projects).

I have an NSColumnItem Selected Value bound to a relationship property (jobParent) in an entity (jobs). This is an inverse relationship to a property (projectChild) in a separate entity (projects).

How do I call on the projectTitle property of my projects entity to display in my NSTableColumn, based on the relationship to the currently selected jobTitle (from my jobs entity) in my NSTableView? I tried entering jobParent.projectTitle for the Model Key Path and arrangedObjects for the Controller Key but it's not working (as well as any other combination I开发者_StackOverflow中文版 can think of). Thanks.


The answer is to make sure the related entity is bound to 'content set' and then address the properties of the related table by using a period after the relationship property of the child entity followed by the property you want of the parent entity. For my example above, to get the projectTitle property of my projects entity in relation to my jobs entity, I would call on:

jobParent.projectTitle
0

精彩评论

暂无评论...
验证码 换一张
取 消