Intercepting user changes to table cells using bindings
Intercepting user changes to table cells using bindings
- Subject: Intercepting user changes to table cells using bindings
- From: BareFeet <email@hidden>
- Date: Thu, 10 Sep 2009 16:09:56 +1000
Hi all,
I have a table view with columns bound to an NSArrayController. The
user can edit the values that appear and it's all working fine.
I have a class called "DataRow" for each row in the table/controller.
Each DataRow is essentially an NSMutableDictionary with a key for each
column name. The column names (and therefore dictionary keys) are
dynamically built according to imported data.
What is the best way to intercept user changes to cells in the table?
I might want to just record the changes or allow/disallow them.
One way, I figure, is to use this method in my DataRow class:
- (void) setValue:(id)value forKeyPath:(NSString*)keyPath
{
NSLog(@"DataRow setValue:forKeyPath:%@", keyPath);
return [super setValue:(id)value forKeyPath:(NSString*)keyPath];
}
This gives the keyPath as: dataRow.The Column Name of the Edited Cell
Is there a built in way to extract the column name (same at the
dictionary key), or should I just parse out based on the delimiting
"." and hope there are no "." in the name?
Or is there a better way altogether to intercept data entry changes?
Thanks,
Tom
BareFeet
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden