home *** CD-ROM | disk | FTP | other *** search
/ Nebula / nebula.bin / SourceCode / OrderByTest / OrderBy.m < prev    next >
Text File  |  1993-01-19  |  1KB  |  44 lines

  1. /* OrderBy.m:
  2.  * You may freely copy, distribute, and reuse the code in this example.
  3.  * NeXT disclaims any warranty of any kind, expressed or  implied, as to its
  4.  * fitness for any particular use.
  5.  *
  6.  * Adam Hertz/William Shipley
  7.  */
  8.  
  9.  
  10. #import <dbkit/dbkit.h>
  11. #import "OrderBy.h"
  12.  
  13. @implementation OrderBy
  14.  
  15. /* Could set these up in NIB -- do it here for pedagogy */
  16. - appDidInit: sender
  17. {
  18.     [[module rootFetchGroup] setDelegate: self];
  19.     [tableView setDelegate: self];
  20.     return self;
  21. }
  22.  
  23. /* Set the sort order before the actual fetch */
  24. - fetchGroupWillFetch: sender
  25. {
  26.     if( sortProp == nil) {
  27.     sortProp = [[tableView columnAt: 0] identifier];
  28.     }
  29.     [[sender recordList]
  30.     addRetrieveOrder: DB_AscendingOrder
  31.         for: sortProp];
  32.     return self;
  33. }
  34.  
  35. /* Find the new sort property every time the tableView column gets moved */
  36. - tableView:sender movedColumnFrom:(unsigned int) old to:(unsigned int) new
  37. {
  38.     sortProp = [[sender columnAt: new] identifier];
  39.     return [module fetchAllRecords: self];
  40. }
  41.  
  42.  
  43. @end
  44.