Table views with different NSArrayControllers sharing the same data object...
Table views with different NSArrayControllers sharing the same data object...
- Subject: Table views with different NSArrayControllers sharing the same data object...
- From: Keith Blount <email@hidden>
- Date: Wed, 27 Feb 2008 16:34:16 -0800 (PST)
Hi,
I'm in the process of putting together a small list view based on an NSTableView. It's pretty simple - just a table of data using an NSArrayController, with a data object that provides the array. However, in my app it is possible that the view may appear in a split view with a copy of itself in the other view (if the user has split the view and selected the same list view for both views). This means that, if the user makes edits to the table in one view, it should automatically be updated in the table in the other view.
What is the best way of setting this up? What I've tried so far is less than perfect. I bind both views/table controllers to the same underlying data object (array). My -setContent: method in my view object sets up observers on all the objects in that array. Still, when -addObject: gets called on one of the tableControllers, this adds an object that the other table controller (controlling the other view) doesn't know about... Obviously, when -adObject gets called, -setContents: isn't called (because the controller's content array isn't actually changed) so the other view doesn't get updated.
Essentially, I want my two table views to act much as two text views would that share the same underlying text storage. If anyone could give me advice on the best way to achieve this, I would be very grateful.
Many thanks and all the best,
Keith
____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping
_______________________________________________
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