• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: No validation with a bound NSTableView and custom NSFormatter
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: No validation with a bound NSTableView and custom NSFormatter


  • Subject: Re: No validation with a bound NSTableView and custom NSFormatter
  • From: Ben Kennedy <email@hidden>
  • Date: Thu, 03 May 2012 17:11:04 -0700

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 (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

  • Follow-Ups:
    • Re: No validation with a bound NSTableView and custom NSFormatter
      • From: Keary Suska <email@hidden>
References: 
 >No validation with a bound NSTableView and custom NSFormatter (From: Ben Kennedy <email@hidden>)
 >Re: No validation with a bound NSTableView and custom NSFormatter (From: Quincey Morris <email@hidden>)
 >Re: No validation with a bound NSTableView and custom NSFormatter (From: Ben Kennedy <email@hidden>)
 >Re: No validation with a bound NSTableView and custom NSFormatter (From: Quincey Morris <email@hidden>)
 >Re: No validation with a bound NSTableView and custom NSFormatter (From: Ben Kennedy <email@hidden>)
 >Re: No validation with a bound NSTableView and custom NSFormatter (From: Quincey Morris <email@hidden>)
 >Re: No validation with a bound NSTableView and custom NSFormatter (From: Ben Kennedy <email@hidden>)
 >Re: No validation with a bound NSTableView and custom NSFormatter (From: Quincey Morris <email@hidden>)

  • Prev by Date: [Sandbox]Question on Design Guide
  • Next by Date: Core Data: Setting attribute of deleted object causes it to remain in store
  • Previous by thread: Re: No validation with a bound NSTableView and custom NSFormatter
  • Next by thread: Re: No validation with a bound NSTableView and custom NSFormatter
  • Index(es):
    • Date
    • Thread