views:

72

answers:

1

In Itunes, there is an "All" filter in the music browser. The user, e.g., can select "All (350 Artists)" to see music across all artists. I have a Core Data backed Master Detail interface where I have a list of groups as master and a list of items in the group as detail, both NSTableViews. I have connected the 2 views together through regular bindings on NSArrayControllers backed by Core Data. I want to add the "All" default option as the first row in my master NSTableView. Will I have to take over the data source function from Core Data in order to add this one item as the first row in my master table or is there a way to add it without sacrificing the free code I am getting from the bindings?

A: 

When I need to add an "All" option to any type of list or grid, I simply add it to the bound data set with a distinct value. For example, if I have a drop down list of Stores bound to the results of a query - I do this (in SQL server, syntax might be slightly different for CoreData):

select 0 StoreNumber, 'All' StoreName
union
select StoreNumber, StoreName from Stores

so the "All" entry becomes part of my bound data.

Ron

Ron Savage