Folks;

I have a simple one column tableView of a managed object.
The text field in the table view is editable.
I want to keep the table sorted when the user manually changes a value,

I have registered for the notification:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myRefreshManagedObjects:) name:NSManagedObjectContextObjectsDidChangeNotification object:[self managedObjectContext]];

This notification is called at appropriate times.
I iterate over the updated set NSUpdatedObjectsKey checking for the entity. If I find a match I determine what tableView is to be updated and call a method which does the following;

- (void) sortManagedTable:(NSTableView *)tableView; {
        //array controllers use 'prepare content' and a fetch predicate
//there is NO binding to a sortDesctiptor - the tableView handles the header clicks correctly without one NSSortDescriptor *titleDescriptor = [[tableView tableColumnWithIdentifier:@"titleValue"] sortDescriptorPrototype]; NSMutableArray *newSortDescriptors = [NSMutableArray arrayWithArray: [tableView sortDescriptors]];
        [newSortDescriptors removeObject:titleDescriptor];
        [newSortDescriptors insertObject:titleDescriptor atIndex:0];
        [tableView setSortDescriptors:newSortDescriptors];      
[tableView scrollRowToVisible:[[tableView selectedRowIndexes] firstIndex]];
        [tableView setNeedsDisplay];
}

But the tableView does not update to reflect the new ordering.
What am I missing?
Steve


_______________________________________________

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 arch...@mail-archive.com

Reply via email to