Sorting NSTableView
Sorting NSTableView
- Subject: Sorting NSTableView
- From: malcom <email@hidden>
- Date: Sat, 29 Jul 2006 12:36:56 +0200
I would to sort an nsarray used as source for table view. This array
is composed by n istances of a class. This class implements two kind
of comparisors:
- (NSComparisonResult) sortObjectByDate:(ANTArtNode *) compareObj;
- (NSComparisonResult) sortObjectByAuthor:(ANTArtNode *) compareObj;
Now I've created two kind of NSSortDescriptors in -awakeFromNib of my
NSTableView:
- (void) awakeFromNib {
NSSortDescriptor *lastNameDescriptor=[[[NSSortDescriptor
alloc] initWithKey:@"DATE"
ascending:YES
selector:@selector(sortObjectByDate:)] autorelease];
NSSortDescriptor *firstNameDescriptor=[[[NSSortDescriptor
alloc] initWithKey:@"AUTHOR"
ascending:YES
selector:@selector(sortObjectByAuthor:)] autorelease];
[self setSortDescriptors: [NSArray
arrayWithObjects:lastNameDescriptor,firstNameDescriptor,nil]];
}
and I've added via Interface Builder keys and selector to my
NSTableView Columns.
But when I run the project and click on headers of my table nothing
happends and the list remain unsorted. So what's wrong?
_______________________________________________
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