Tips on how to display NSArray of NSDictionaries using NSTreeController?
Tips on how to display NSArray of NSDictionaries using NSTreeController?
- Subject: Tips on how to display NSArray of NSDictionaries using NSTreeController?
- From: Rick Hoge <email@hidden>
- Date: Wed, 4 May 2005 13:16:29 -0400
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:
This email sent to email@hidden