• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Getting the values from the selected row of a table?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Getting the values from the selected row of a table? (From: John Velman <email@hidden>)

  • Prev by Date: Re: Manipulate the NSTextview, several questions...
  • Next by Date: How can I access full source of a WebView
  • Previous by thread: Re: Getting the values from the selected row of a table?
  • Next by thread: Cocoaheads Lake Forest (92630) meeting 10/8/2008 at 7 pm on "Parallel Processing with a Core Data Store"
  • Index(es):
    • Date
    • Thread