Thanks for the clarification Graham. It seems that retrieving data ordered (rows and columns) the same as the view is a common task. Apples solutions are pretty well thought out and encompassing so I was surprised there was not an easier way to get it. There's nothing worse than coding something yourself only to discover soon after that there is a standard method to do the job. The dataCellForRow: sent me on a wild goose chase too. It was still pretty easy though once I figured out how to correlate the view arrangement with the array data.

Steven Riggs

On Nov 4, 2008, at 11:57 PM, Graham Cox wrote:


On 5 Nov 2008, at 3:46 pm, Steven Riggs wrote:

This feels like a workaround for not being able to get the data straight from the table view


Can I just point out something? NSTableView is a view - the clue is in the name. Thus interrogating it for data is a little silly, no?

You should always go back to the source (i.e. the data model) when you want something from it, don't ask the view, that's just not its job.

You would think that would work. I don't know why it doesn't but I've been here before.

The reason it doesn't work is because the table view only has one cell per column, and moves it around as new data is retrieved from the datasource and displayed. The table VIEW doesn't keep a copy of the data, so you can't ask it for it.

The only information you can ask the table view for is a) which rows are selected and b) what are the names/identifiers of the columns. From that you have what you need to go back to the actual data and do something with it.


--Graham

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to