title: How do you Sort Bound Data in NSTableColumn using InterfaceBuilder binding?
body: <p>Sorting Bound Data in NSTableColumn using IB binding.</p>
  
  <p>Keys: NSTableColumn , sorting, NSArrayController, Content Set</p>
  
  <p>A contentSet serves like a data source for a TableColumn</p>
  
  <p>This deals with a SplitView with two single column NSTableViews
  The names of the TableViews are BookCategory and
  Books.
  The Books Table has a single column with book_titles.
  The Class BookCategory has a  one to many relationship
  to Book. </p>
  
  <p>The BookCategory Table is sorted at load using:</p>
  
  <pre><code>@implementation MyBookCategoryController
  
  - (id)init
  {
      self = [super init];
      if (self) {
          // Initialization code here.
         NSSortDescriptor *descript = 
         [NSSortDescriptor sortDescriptorWithKey:@"name"
                      ascending:YES selector:@selector(caseInsensitiveCompare:)];
  
         [self setSortDescriptors:[[NSArray arrayWithObject:descript] autorelease] ];
  
      }
      return self;
  }
  </code></pre>
  
  <hr>
  
  <pre><code>This same approach fails to sort the BookTitle table at load.  !!
  
  The BookTitle table/column loads unsorted.
  
  For the TableColumn the Attributes Inspector has  
   Sort Key:title
   Selector: caseInsensitiveCompare:
   Order: Ascending
  </code></pre>
  
  <p>This appears to enable the sorting when one clicks
  on the column header. </p>
  
  <pre><code>I want the data sorted when the view loads. 
  
  The binding inspector for this book_title column has:
   Value : BookCategoryArrayController.arrangedObjects.name
  
  The BookTitleArrayController in binding inspector shows 
   Content Set: Book Category ArrayController.selection.books
  </code></pre>
  
  <p>To restate the problem, the tableview with the book titles
  load unsorted. It sorts only after the user's FIRST click on the
  column header.</p>
  
  <p>Say there are three book categories Art, History, Sports.
  When the app loads the left table in the splitview is sorted,
  that is :</p>
  
  <pre><code>Art
  History
  Sports
  </code></pre>
  
  <p>When the user selects ANY category, titles for all books
  in the category appear in the right tableView but unsorted.
  If the user clicks on the Header of the book_title TableColumn
  the initial sorting is done on the column.  Thereafter
  the selection of ANY book category causes a sorted display
  of book_titles in the right tableView. That is, ONLY the first
  selection of a category results in an Unsorted book title list.</p>
  
  <p>Thanks a lot for reading, Mark</p>