Re: Refreshing of NSTableView with Snow Leopard - solved

Trent Jacobs <[email protected]>
Newsgroups gmane.comp.macosx.devel
Message-ID <[email protected]>
Thanks to Markus and Kyle for your help.

I have solved the issue but I'm still a bit perplexed...

Firstly I have to state that I was using the NSArrayController to handle the sorting for me, based on what the user selected. Here was the code I used to set the sorting (I should have included this in my original post):

	NSSortDescriptor* sortBySongPosition;
	sortBySongPosition = [[NSSortDescriptor alloc] initWithKey:@"songPosition" ascending:YES];
	[arrSongSetEntryController setSortDescriptors: [NSArray arrayWithObject: sortBySongPosition]];

Now as I have stated, this works on all versions prior to Snow Leopard, but with Snow Leopard there was no change in the rendering of the NSTableView. However, when I modified the code to be:

	NSSortDescriptor* sortBySongPosition;
	sortBySongPosition = [[NSSortDescriptor alloc] initWithKey:@"songPosition" ascending:YES];
	// I added this line:
	[arrSongSetEntryController setSortDescriptors: nil];
	[arrSongSetEntryController setSortDescriptors: [NSArray arrayWithObject: sortBySongPosition]];

It worked. 

Hope this helps someone...

Thanks,
Trent.

On 5 Jan 2010, at 14:08, Markus Hitter wrote:

> 
> Am 04.01.2010 um 22:54 schrieb Trent Jacobs:
> 
>> I'm really confused as to why calling reloadData isn't refreshing the table.
> 
> Perhaps, because the table's contents and the controller's arrangedObjects get out of sync this way? Perhaps the table even reloads, just to be re-reloaded by the controller after that. If things go fast, you wouldn't even see a flicker.
> 
> As it was already said, getting the NSArrayController to sort those objects the way you want is the way to go.
> 
> 
> Markus
> 
> - - - - - - - - - - - - - - - - - - -
> Dipl. Ing. Markus Hitter
> http://www.jump-ing.de/
> 
> 
> 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.