1
votes

In my project, I have two Core Data entities. One is the grouping (can be thought of as an iTunes playlist) and the other the children. I currently have an NSTableView set up as a sort of source list and another for displaying the individual items. Both are bound to NSArrayControllers which are set to the appropriate entities.

This all works fine as it is. I can add, remove, and edit both groups and items. But what would be the best way to filter the contents of the item table based on the selection of the source table? Would a predicate do the trick?

Here's my data model: Data Model

1

1 Answers

2
votes

Use an NSPredicate to filter your data model:

NSPredicate *myFilter = [NSPredicate predicateWithFormat:@"..."]; /* build the predicate based on what is selected */
[myArrayController setFilterPredicate:myFilter];