Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Tips on how to display NSArray of NSDictionaries using NSTreeController?




Like many I'm very happy to see the appearance of NSTreeController in Tiger. However it seems the documentation is still a bit thin and I'm having trouble getting what seems like a simple thing to work (yes, I filed an enhancement request for more docs :).


I have an NSArray of NSDictionaries, and would like to present a hierarchical view of the contents.

Each dictionary in the array has three keys: 'description' 'settings' and 'results'

The value for 'description' is an NSString
The value for 'settings' is another NSDictionary
The value for 'results' is another NSDictionary

What I'd like to do is have the top level of the NSOutlineView show the value for the 'description' key, and the next level of disclosure show the set of key/value pairs for the 'settings' dictionary

Here's what I tried:

I bound the value attribute of the leftmost column in the view to arrangedObjects of my NSTreeController (whose contentArray is bound to the appropriate instance variable in my model). This does cause the description value to be shown in the top level of the outline, but I can't get the next level to show. I've been binding the second column to arrangedObjects of the same NSTreeController using different values for 'model key path'. I'm really not sure what this should be - have tried 'settings' but this only shows a single left brace.

Any tips on how the bindings need to be set or whether this is even possible given my data structure would be much appreciated!

Rick

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.