Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5945617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:42:25+00:00 2026-05-22T16:42:25+00:00

Sorting Bound Data in NSTableColumn using IB binding. Keys: NSTableColumn , sorting, NSArrayController, Content

  • 0

Sorting Bound Data in NSTableColumn using IB binding.

Keys: NSTableColumn , sorting, NSArrayController, Content Set

A contentSet serves like a data source for a TableColumn

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.

The BookCategory Table is sorted at load using:

@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;
}

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

This appears to enable the sorting when one clicks
on the column header.

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

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.

Say there are three book categories Art, History, Sports.
When the app loads the left table in the splitview is sorted,
that is :

Art
History
Sports

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.

Thanks a lot for reading, Mark

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T16:42:25+00:00Added an answer on May 22, 2026 at 4:42 pm

    This is an outline of what finally worked for me.

                Sorting with CategoryArrayController (NSArrayController)
    
          Bindings Inspector
             Content Set  Bind to: CategoryArrayController.selection.books
    
             SortDescriptors Bind to: ShareUserDefaultsController
              Controller Key: values
              sortDescriptors  (note:  exclamation point)
              NSUnarchiveFromData
    
        Shared User Defaults Controller 
            Referencing Outlets
              userDefaultsController -- AppController (C:AppController)
            Referencing Bindings
                values.sortDescriptors -- Sort Descriptors Rx Array Controller (C:NSArrayController)
                                       -- Sort Descriptors Category Array Controller (C:NSArrayController)  
    
          Clicking on Category Header does no sort. Selects all in Cats, and empties Recipe Table
          Comments on the above welcome.
    
        TableViewCat (NSTableController)
            Attributes Inspector
              TableView
                Selection 
                    Empty,Column,Type Select
              Control
                 State.Enabled
            Connections Inspec
                None
            Bindings Inspec
                None
    
          TableColumn -Category (NSTableColumn)
            Attributes Inspec
                Sort Key : None
            Bindings Inspec
                Value -- Category Array Controller.arrangedObjects.name
    
    
        Sorting with RxArrayController (C:NSArrayController)
          Attributes Inspec
             Array Controller: 1-5 of 6
             Object Controller
               EntityName: Recipe
                 Prepares Content
                 Editable
          Connections Inspector
            Referencing Bindings
              arrangedObjects.name -- Value - Table Column Recipe
              selectedObjects      -- Double Click Argument - Table View Book
          Bindings Inspector
           Controller Content
             Content Set
               Category Array Controller.selection.books
           Controller Content Parameters    
             Sort Descriptors Bind to: ShareUserDefaultsController
              Controller Key: values
              sortDescriptors  (note:  exclamation point)
              NSUnarchiveFromData
            Parameters  
              Managed Object Context(App Delegate.manangedObjectContext
    
        TableView Book (NSTableView)
            Attributes Inspector
              TableView
                Selection Empty,Column,Type Select
              Control
                State.Enabled
            Connections Inspec
                Bindings
                    DoubleClick Argument -- Book Array Controller.selectedObjects
                    Double Click Target  -- App Delegate.self
            Bindings Inspec
                Double Click Argument (Book Array Controller.selectedObjects)
                Double Click Target (App Delegate.self)
                    Bind To: App Delegate
                        Model Key Path: self  (Repeats ?)
                        Selector Name: newBookAction: 
                          Conditionally Sets Enabled
    
          TableColumn - Book (NSTableColumn)
            Attributes Inspec
                Sort Key : None
            Connections Inspec
                Bindings
                    Value -- Book Array Controller.arrangedObjects.name
            Bindings Inspec
                Value -- Book Array Controller.arrangedObjects.name         
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an NSTableView bound to a core-data-backed NSArrayController by binding individual columns to
This recent question about sorting randomly using C# got me thinking about the way
I have a WPF sorting/binding issue. (Disclaimer: I am very new to WPF and
I am somewhat familiar with sorting in Scala using Ordering 's, however I would
I'm using DevExpree XtraTreeList Control, I want to randomly Set one of the first
I'd love to add some sorting to an EntityCollection that is bound to an
Certain features for data-bound grid controls are a given and should be available in
When sorting on a column in the GridView bound to an Enum, it sorts
For example, in sorting the tight lower bound is N*log(N) where N is the
I have an NSTableView with columns bound to an NSArrayController . The table view

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.