• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Sorting NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Sorting NSTableView
      • From: malcom <email@hidden>
  • Prev by Date: Re: Quick way to convert hex string represented in ASCII to binary?
  • Next by Date: Binding NSArrayController to 2 NSArrayCOntroller selection
  • Previous by thread: Re: Quick way to convert hex string represented in ASCII to binary?
  • Next by thread: Re: Sorting NSTableView
  • Index(es):
    • Date
    • Thread