• 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: filling a TableView with pre-existing data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: filling a TableView with pre-existing data


  • Subject: Re: filling a TableView with pre-existing data
  • From: Scott Frankel <email@hidden>
  • Date: Mon, 1 May 2006 20:38:20 -0700


Biting off more than I can chew is one of the most defining hallmarks of my existence ;)


Thank you & Ondra very much for your patience and suggestions. Finding the right trailhead is at least half the battle. - windowControllerDidLoadNib and the array's controller outlet seem to be exactly what I was looking for.

Onward -
Scott




On May 1, 2006, at 5:07 PM, I. Savant wrote:

Scott:

If I may, I think you've bitten off a bit more than you're ready to chew yet. You asked how you would connect the array controller to your document. This knowledge is something you should master before tables and bindings.

If it's as simple as getting the array controller to -add: an object (for your table to display), just connect a button to the array controller's -add: action. If you really need to talk directly to your array controller from your document, create an outlet and connect it.

If you want to add some default data when the document loads, - windowControllerDidLoadNib is a great place to create the objects that represent your 'rows' and add them to the array controller's content (via NSArrayController's -addObject: method).

You should go back to the book and review at this point until you at least understand IBActions and IBOutlets. Apple's introduction to Cocoa documentation would be an excellent source for another perspective on this. You will also need to read the documentation on NSArrayController to make sure you fully understand exactly what those messages you're sending it are doing and, for that matter, what messages you *should* be sending it to get it to do what you want it to.

  I hope this helps.

--
I.S.


On May 1, 2006, at 7:04 PM, Scott Frankel wrote:


I hope my question made sense. I've got an NSTableView that I want to use to display rows of data from a database. I'm using Bindings, KVC-style accessors, and an NSArrayController to manage the model-view data flow. But I'm having trouble turning the spigot on ;) I'm not getting my data rows to display in the tableView.


The most promising approach seems to be overriding awakeFromNib: in MyDocument.m. How would I connect the NSArrayController to this layer of the app's controller? Am I barking up the right tree at least?

Thanks again!
Scott


p.s. I've read Apple's doco on bindings and am following Hillegas' book; so I can create data from scratch in my tableView. Still, how do I load data that already exists into an NSTableView?





On May 1, 2006, at 10:37 AM, Scott Frankel wrote:


How does one fill an NSTableView, set up to use bindings, with pre-existing data?


If a nib file's NSArrayController's ObjectClassName parameter corresponds with an implementation file of a class I created with KVC-style accessors (the M-V-C model), then shouldn't the model class' init: method get called when I run the app? I note that my init: method's NSLog statement is never returned.

Seems that somewhere, I'm not connecting the dots.

Following the property list Dict example in http:// developer.apple.com/documentation/Cocoa/Conceptual/TableView/ index.html#//apple_ref/doc/uid/10000026i), where should this Dict live so that the NSTableView's NSArrayController can find the data and display it? In the model class' init: method? Is there a method I should be overriding to trigger a data load?

Thanks in advance!
Scott








_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40pacbell.net


This email sent to email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com


This email sent to email@hidden


_______________________________________________ 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: 
 >filling a TableView with pre-existing data (From: Scott Frankel <email@hidden>)
 >Re: filling a TableView with pre-existing data (From: Scott Frankel <email@hidden>)
 >Re: filling a TableView with pre-existing data (From: "I. Savant" <email@hidden>)

  • Prev by Date: Re: Finder's File Search Interface
  • Next by Date: Re: Refactoring tools available for Cocoa / ObjC?
  • Previous by thread: Re: filling a TableView with pre-existing data
  • Next by thread: Re: filling a TableView with pre-existing data
  • Index(es):
    • Date
    • Thread