Re: Getting the values from the selected row of a table?
Re: Getting the values from the selected row of a table?
- Subject: Re: Getting the values from the selected row of a table?
- From: Graham Cox <email@hidden>
- Date: Wed, 8 Oct 2008 09:53:39 +1100
On 8 Oct 2008, at 5:55 am, John Velman wrote:
I'm able to get the selected row index, but this seems to give the
"geographic" index of the selected row in the table, as sorted.
Because a table is a view, the selection is purely "geographic", since
the table's job is to map an item of data to a location on screen.
So far, I've solved my problem by ensuring that the table source is
sorted
by it's primary key, and blocking sorting in the table itself. This
is not
too bad for my application (in it's current state, at least), but
eventually I'd like to be able to sort the table interactively and
map the
selection back to the original data.
When the table is sorted, its delegate is notified to actually perform
the sort of the data. Just make a note of which item(s) are selected,
perform the sort, then update the selection to the new positions of
the existing selected items.
Remember that the table view itself is not part of your data model. It
shows exactly what you want it to show - if its concept of "selection"
is not appropriate for your data model, then maintain the selection in
the data model and drive the table view to match.
hth,
Graham
_______________________________________________
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