Re: Intercepting user changes to table cells using bindings
Re: Intercepting user changes to table cells using bindings
- Subject: Re: Intercepting user changes to table cells using bindings
- From: Sean Kline <email@hidden>
- Date: Fri, 11 Sep 2009 06:52:39 -0400
Tom,
Would this not be an application for Key-Value Observing?
Regards,
Sean
On Thu, Sep 10, 2009 at 2:09 AM, BareFeet <email@hidden>wrote:
> 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
>
_______________________________________________
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