Updating an array controller that's bound to more than one table

I have a document based app with a main window. On this window is a button that loads a nib with another window that has a table on it, bound to an array controller, which is populated by a text file. I need to be able to add an undetermined number of windows to a document, each with it’s own identical table, each table having different data.

So far I’ve got part of it working - I add window 1, it opens and the table populates from text file 1. I add window number 2, it opens and populates from text file 2, and so on.

But then if I want to update the data in any one of these tables, regardless of which window is key, it always updates the table in the last window I created. Is there any way to tell which instance of the table I want the array controller to update?

It sounds like you need separate array controllers…

The problem is I don’t know how many tables will be created by the user, so I don’t know how many array controllers to add. Is there a way to add them programmatically?

It works well to just load the nib which adds another window and then put the data in, but now I realize getting that data out or modifying it doesn’t work because the array controller only holds the data in the last table. I’m surprised when I update it the data doesn’t update in all the tables identically. How can that be?

So much of this is mysterious to me.

Shane -

I’m switching to a new approach, using one table and one array controller that swaps out data based on a selected row in another table, so no need to spend any brain power on this. The drawback is the user can’t see all the tables at once but I can live with that. This will make for a much simpler interface.


That’s usually a good thing.