views:

21

answers:

1

Hello there, I am new to mac, and I am in trouble. I need to bind NSTableView to 2D data at the back end so that I can have dynamic update of data at the front end. I have 5*10 data at the back end that I want to bind it to NSTableView. I have tried almost every approach, read every article, implemented examples from the internet but it isn't working.

I have tried different ways to store my 2D data and to connect it with the NSArrayController, but no results. I tried to represent a row with NSMutableDictionary with 5 different keys representing the 5 columns and their values respectively and then encapsulated the the dictionary object in an NSMutableArray object. Tried to bind NSTableColumn with the NSArrayController as well.

I would be obliged if anyone can tell me what data structure should I use, how many NSArrayControllers or NSObjectController should be there and what should be the correct values of controller keys and model in path in the inspector for every element involved. I would appreciate if anyone can provide me with an example closely related to the problem above.

Regards Umair

+2  A: 

You can't use Bindings for this. Bindings in a table view is for displaying a one-dimensional list of objects, where the columns are properties of each object.

In your case, every row-column intersection is a discrete object. Therefore, you need to implement a data source, if not use or create a different view entirely.

Peter Hosey
thanks for your help, I just want to ask that I tried to bind my NSArraycontroller to an NSMutableArray, the array hold objects of type "iData" (its a custom class). The class further contains some NSMutableString variables, the variables are set as keys for KVC. Further i bind the my NSTableColumn to the NSArrayController and set key model paths of every column respectively. But when I try to populate the array I dont see any results on the Table in the GUI.
Omayr