Reordering a table view with Core Data
Reordering a table view with Core Data
- Subject: Reordering a table view with Core Data
- From: Andrew Merenbach <email@hidden>
- Date: Tue, 9 May 2006 11:56:33 -0700
Hi, all. I have a Core Data application with a single-column table
view that has two sort descriptors. The default descriptor set at
startup and when the table header is clicked, and sorts the table's
contents alphabetically.
I want to implement drag-and-drop, which will have to turn off the
initial sort descriptor, and that's where the second descriptor comes
in. It sorts by my objects' 'index' field, and I need here to figure
out a way to assign indices appropriately so that when the view is
sorted, items appear in the user's defined order, but are really
adhering to a sort descriptor.
***(If there's a better way to do this, I'd love to hear it!)***
So I'm wondering:
1. Where are the best places to put index-assignment code?
2. How should indices be assigned? Should they be consecutive
numbers, or should there be space between them?
3. If there's space between the indices, is there some way not to
assign every time through.
I thought that I'd seen a post about this, but I can't seem to find
it again, and it concerned only #3, I think. This does just scream
for a manual entry, some sample code, or an archive post, but all of
my searches (bar the one that I mentioned) have come up empty. Any
guidance (or even RTFMs :p) would be appreciated, as I've been
banging my head on this for months now.
Thanks so much,
Andrew
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden