views:

89

answers:

1

Hi all,

I've an NSTableView that uses the controller object for the NIB being displayed as the data source. I implement the NSTableView informal protocol.

This NSTableView gets its values from Core Data. I startup the application, load all values I have in XML and then display them.

My problem is, the NSTableView doesn't seem to add any new rows to the end of the table. If I start the application with no values in permanent storage and add another one (adding values works as I can see them being saved to XML), the table view simply ignores the new value.

If I add a value I know will go to the end of the table (the contents are organized alphabetically), I won't see the new value.

If I and a value that I know won't go to the end of the table, the value will be added, I will see it on the table, but the last value on the table will be pushed out and disappear.

I've noticed that - (int)numberOfRowsInTableView:(NSTableView *)tv is only being called when the application starts up and not when I do [tableView reloadData]. What causes this event to be fired? I tried firing it by hand before calling reloadData on the tableView but doesn't seem to work.

Any ideas to what might be causing this?

Has anyone encountered something like this? Any clues to what might be?

A: 

Alex's comment made me review the code, specifically bindings in Interface Builder. Turns out I had set the bindings between the table and my controller object and implemented the NSTableDataSource.

I've removed all bindings and only implement the NSTableDataSource protocol.

Rui Pacheco
I would recommend going the other way. Core Data and Bindings are designed to work together.
Peter Hosey