• 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: Can you populate an NSTableView with an NSEnumerator?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can you populate an NSTableView with an NSEnumerator?


  • Subject: Re: Can you populate an NSTableView with an NSEnumerator?
  • From: Chris Hanson <email@hidden>
  • Date: Tue, 31 Oct 2006 13:29:45 -0800

On Oct 31, 2006, at 10:58 AM, Jarrod Roberson wrote:

I can only find documentation on populating an NSTableView with an NSArray,
for very very very very large datasets what is the prefered idiom(s)?

You don't need to use an NSArray, whether you're using a data source or bindings.


If you're using a data source, just implement the methods to use your own back-end rather than to use an NSArray as a back-end. NSTableView will invoke the data source methods as appropriate for the data that's currently displayed.

If you're using bindings, you can bind your table's columns through a key that represents your underlying data, and then implement appropriate key-value coding indexed accessor methods for that key. These are methods like -countOfFoos, -objectInFoosAtIndex:, - getFoo:range: (if profiling shows it's necessary for performance), etc. These methods can access your underlying data in any way they want, as long as appropriate key-value observing messages are posted when the underlying data changes. Just as with a table view data source, the object providing this key will only be asked to provide data that's relevant for what's actually being displayed.

The key point to remember is that your code doesn't populate an NSTableView. Instead, an NSTableView is given a data source or has its columns' values bound, and the NSTableView populates itself. In particular, don't think of a table view, an outline view, or any other control in Cocoa as "owning" the data that it contains; it doesn't. The data is owned by the underlying model objects, while your human interface is just providing a view on that data.

  -- Chris

_______________________________________________
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


References: 
 >Can you populate an NSTableView with an NSEnumerator? (From: "Jarrod Roberson" <email@hidden>)

  • Prev by Date: RE: NSOpenGLView and resizable NSWindow problem
  • Next by Date: [MEET] November CocoaHeads Meetings
  • Previous by thread: Re: Can you populate an NSTableView with an NSEnumerator?
  • Next by thread: NSOpenGLView and resizable NSWindow problem
  • Index(es):
    • Date
    • Thread