Re: Core Data: Forcing update of NSTableView bound to an NSArrayController
Re: Core Data: Forcing update of NSTableView bound to an NSArrayController
- Subject: Re: Core Data: Forcing update of NSTableView bound to an NSArrayController
- From: John Bishop <email@hidden>
- Date: Wed, 9 Aug 2006 08:12:08 -0500
Perhaps your import took place outside arrayController's
NSManagedObjectContext. If so, how about something like this:
if ([arrayController fetchWithRequest:nil merge:YES error:&error]) {
NSArray *newSelection = ...;
[arrayController setSelectedObjects:newSelection];
}
If your tableView contents are bound via arrayController, I don't think you
need to do the reload.
John
--------------------------
Bill Coleman <email@hidden> said:
>I previously had asked about performing a document-modal operation. I
>had tried using NSThreads, but due to the complex multi-threading
>issues, I've taken the advice of Jakob Olesen and am using what he
>termed a tail-call recursion using
>performSelector:withObject:afterDelay:.
>
>This works quite well in creating a document-modal operation, my only
>complaint is that it pauses importing or exporting while you hold a
>menu down. I can live with that - kind of reminds me of old Classic
>MacOS applications that processed on Idle events.
>
>When the import operation finishes, I do a number of calls to attempt
>to reposition the NSTableView to show the last item in the table.
>However, the NSTableView doesn't appear to recognize all the records
>I've imported until sometime after this, because the scroll position
>is still at the top. Or if a few records are recognized in the middle
>of the import, it scrolls to the end of the few it recognized.
>
>Here's the code sequence after the import:
>
> [self endProgressSheet]; // puts away the document-modal sheet
>
> [arrayController rearrangeObjects];
> [tableView reloadData];
> [tableView scrollRowToVisible: [ [arrayController arrangedObjects]
>count] - 1];
>
>I've noticed that if I include the [arrayController addObject:] call
>during my import, the NSTableView seems to keep up with the changes
>as I go, although it somehow messes up the putting away of the sheet
>at the end. Several responders indicated I shouldn't do that, since
>the array controller is bound to the managed context.
>
>So, how to I force the table to update at the end?
>
------------------------------------------------------------------
John Bishop <mailto:email@hidden>
Mulligan Software <http://www.mulligansoftware.com>
Mulligan's Golf Personal - Stats & Handicapping for the Mac Golfer
_______________________________________________
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