Sign In/My Account | View Cart  

advertisement

AddThis Social Bookmark Button

Article:
  Mac OS X's Preferences System (and More!)
Subject:   Sorting?
Date:   2001-09-15 06:08:57
From:   n9yty
Response to: Sorting?


Oh, forgot something...


I figured that once I had the identifier tag for the clicked-column, I could simply call the records sortUsingFunction, with a function that uses caseInsensitiveCompare on the values in the given column, which will be plucked out by the identifier name, passed into the function via the context: parameter.


[records sortUsingFunction:stringSort context:identifier]


and stringSort is basically something like:


NSString *v1 = [val1 objectForKey:context];
NSString *v2 = [val2 objectForKey:context];


return [v1 caseInsensitiveCompare:v2];


Is this really off track?


Thanks again!


Full Threads Oldest First

Showing messages 1 through 2 of 2.

  • Sorting - Sorting it out...
    2001-09-15 20:21:36  n9yty [View]


    Okay, found my problem with using the doubleAction to set the selector, I didn't know I had to setTarget first... Got that done, and now everything else has fallen into place and it seems to work great.... Hmm... Instead of sorting based on column clicked on, though, I'm wondering about a sort button that sorts based on the order you have columns positioned? Food for thought, but it's working as-is for now.
    • HELP!!!
      2002-02-08 02:40:53  stupidfish23 [View]

      Hi there! Could anyone post a working source code that makes the table sort its records? I just can't get it to work...

      Please?

      Email me at: stupidfish23@mac.com