Binding to an array of dictionaries as a to-many
Binding to an array of dictionaries as a to-many
- Subject: Binding to an array of dictionaries as a to-many
- From: Paul Collins <email@hidden>
- Date: Mon, 21 Mar 2005 01:44:43 -0800
My bindings-driven view of some custom objects is working well, except
for one thing. I have a class MyRecord containing an ivar iPersons,
containing an NSArray of NSDictionaries. One of the keys in the
dictionaries is "Name". I want to obtain the array of a particular
key's values from those dictionaries, which KVC docs say can be done
with dot notation. When I bind an NSTableColumn to this, I get this
error:
[<NSCFArray 0x579b60> addObserver:forKeyPath:options:context:] is not
supported. Key path: Name
To diagnose, I tried accessing the data directly with KVC:
NSArray *names = [myRecordInstance valueForKey:@"iPersons.Name"];
But I get an exception saying: [<MyRecord 0x537b20>
valueForUndefinedKey:]: this class is not key value coding-compliant
for the key iPersons.Name.
What do I need to do in my MyRecord class to make this work?
FYI, I got a Master-Detail view working fine, with an NSTable bound to
arrangedObjects, and various detail fields bound to selection. The
problem is my detail view needs its own table of to-many data pulled
from the object selected in the master table. The bound value for the
detail table column is "selection.iPersons.Name".
Any suggestions?
--Paul Collins
** Gracion Software http://www.gracion.com/ **
** Tel: +1 (541) 488-3488 iChat/AV/AIM: gracionsoft **
** DigiTunnel 1.4 PPTP/VPN client for OS X **
_______________________________________________
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