On 01 May 2012, at 9:09 pm, Quincey Morris wrote:

> When you bind one or more table columns to an array controller, the table 
> view automatically binds its own content binding to the array controller 
> (presumably with some heuristic for choosing one out of several, if you 
> happened to bind different columns different ways). It doesn't seem 
> impossible that the table view honors cell formatter errors only when its 
> content binding isn't used (i.e. pure data source for all columns). 

That seems like a reasonable explanation (although I see no inherent reason why 
it must be the case, nor have I found it documented, alas.)

I have re-worked things to take full advantage of bindings now, so as to get 
the more desirable automated validation handling.  However, I've now come up 
against another challenge.

As I may have alluded in an earlier posting, I need to be able to perform a 
cascading update on the data set in response to a particular row being edited.  
Previously, this was trivial to do with a for loop in the delegate's 
-[tableView:setObjectValue:forTableColumn:row:], but now requires some trickery.

I've found myself overriding -[editColumn:row:withEvent:select:] and 
-[textShouldEndEditing:] in a NSTableView subclass in order to have a hook into 
performing an operation post-edit in relation to the modified row.  This feels 
filthy, but I yet haven't seen how better to do it.

I considered that I could register as a KVO observer for each of my data 
objects (and then use [arrayController.arrangedObjects indexOfObject:object] as 
the basis for my cascading update), but that requires adding extra 
-[addObserver:...] code accompanying everywhere I have an [arrayController 
addObject:], which seems prone to oversight.  Is there a better way?

Separate from the above, I also have a new performance problem.  The loop in 
which I do my cascading updates executes inordinately slowly; simply assigning 
new values for two properties takes about 0.45 seconds when iterating a data 
set of a mere 135 objects.  It used to be instantaneous before bindings came 
into the picture.  I suspect that all of the KVO overhead is to blame (a quick 
peek in Instruments supports this).  Is there something fundamental I'm missing 
to avoid this bottleneck?

thanks,

b

--
Ben Kennedy, chief magician
Zygoat Creative Technical Services
http://www.zygoat.ca


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to