A follow up question: how do I now sort the data in the table? I am showing 
three values in the table, and like to sort based on either one of them. The 
original data is in an unordered NSSet (from my CD model). I could create an 
NSArray in my view controller: NSArray *myArray = [myTagsSet allObjects], and 
bind that to the NSArrayController, instead of to the NSSet; then I can sort 
the values in the table based on the array using sortDescriptors as explained 
here: 
https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/TableView/SortingTableViews/SortingTableViews.html#//apple_ref/doc/uid/10000026i-CH10-SW1.
Would that be a good approach?

Other alternatives?

OSX, 10.7.

Thanks,

- Koen.





On Jul 4, 2012, at 5:59 PM, Koen van der Drift wrote:

> Ok, I found the solution.
> 
> I added an NSArrayController to the nib, of which I bound the content set to 
> the NSSet of my model.  Then I bound the NSTableView to the 
> NSArrayController, and the views to the various attributes through the 
> objectVAlue.
> 
> - Koen.
> 
> 
> On Jul 4, 2012, at 1:46 PM, Koen van der Drift wrote:
> 
>> Hi,
>> 
>> I am trying to hookup a view based NSTableView to my CoreData model using 
>> bindings.  The table should display various attributes of the entity 'Tags', 
>> which has a many-to-one relationship with my main entity. In my code I can 
>> see that the Tags entities are valid using NSLog statements, however I fail 
>> to use the correct binding to hook it up to the table. From the docs (at 
>> <https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/TableView/PopulatingViewTablesWithBindings/PopulatingView-TablesWithBindings.html#//apple_ref/doc/uid/10000026i-CH13-SW1>),
>>  I see I need to bind the table to an NSArrayController, however, my Tags 
>> are an NSSet.
>> 
>> How do I solve this?
>> 
>> Thanks,
>> 
>> - Koen.
> 


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to