Maintain and organize the order of master data records
I followed the master data tutorial at
http://macresearch.org/cocoa-scientists-part-xxiii-itunes-ifying-core-data-app
The finished application displays data in an NSTableView. Is the ordering of the data preserved? And is there a way to allow permutations to be dragged into the order of records? I'm thinking of something that reminds me of how iTunes lets you drag and drop songs in a playlist.
a source to share
Core Data expects you to define your own collation using NSSortDescriptors, so you will have to add your own attribute to track a custom ordering index like a user. I have had good luck using KVO on the entity relationship key path (from the managed entity itself) to reorder as needed when new relationship entities are added or removed.
To handle regrouping, you will want to use the NSTableView drag and drop methods and reset the order index attribute as needed. The NSTableView documentation should explain this pretty well.
a source to share
Instead of using an integer, I use the actual date and time (kind of timestamp) of creation. This will avoid duplicating your order field.
Then when I move the item up / down, I just change my order field. It has a relatively low processing cost.
When I fetch the data, I just select the items in the order of the am field.
a source to share