I have a list of data with parent-child hierarchy up to three levels. For example
- ItemA (Grandparent)
- ItemB1 (Parent)
- ItemC1 (Child)
- ItemC2 (Child)
- ItemC3 (Child)
- ItemB2 (Parent)
- ItemC4 (Child)
- ItemB1 (Parent)
- ...
All of the items are located in a single NSArrayController and I want to filter the array by using NSFetchRequest which will result child items and their parents.
For example, if my query matches to ItemC1 and ItemC3 the filtered result should be
- ItemA (Grandparent)
- ItemB1 (Parent)
- ItemC1 (Child)
- ItemC3 (Child)
- ItemB1 (Parent)
All items have parent and children(1-N) properties in order to track the relationships.
Any suggestions will be appreciated.