• 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
NSTreeController / NSOutlineView vs. sorting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTreeController / NSOutlineView vs. sorting


  • Subject: NSTreeController / NSOutlineView vs. sorting
  • From: Pierre Bernard <email@hidden>
  • Date: Tue, 30 Aug 2005 23:30:26 +0200

Hi!

I have an NSOutlineView set up using bindings with an NSTreeController back-end. The tree controller holds CoreData managed objects: nodes and leafs sharing a common parent entity. The parent entity has an int attribute, sortIndex, according to which I would like to sort both nodes and leafs. I.e. for each node I want the children, be they nodes or leafs, sorted ascending according to sortIndex.

So far I have tried the following to no avail:

- binding sortDescriptors on the tree controller
- binding sortDescriptors on the outline view
- adding an orderedChildren method to the node object

While I do manage to produce an initially sorted view, new items (created in business code) always end up at the end, rather than being sorted in according to their index value. Neither of the below two calls can make any difference:

    [outlineView reloadItem:[document rootNode] reloadChildren:YES];
    [outlineView reloadData];

The Apple documentation is not actually vocal on the subject. I find no recommendation on which of the above three approches to prefer. Nonetheless, the third one seems like really redundant given the possibility to specify sort descriptors. The documentation does fail to mention what exactly the sort descriptors will be applied to. Root nodes only, or children of each node.

Anyone managed to get a sorted outline view, preferably using bindings?

TIA for your thoughts,
Pierre
_______________________________________________
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: NSTreeController / NSOutlineView vs. sorting
      • From: Timothy Larkin <email@hidden>
  • Prev by Date: Is it possible to put anything other then text in NSComboBox popup?
  • Next by Date: Re: Tableviews like Excel ones
  • Previous by thread: Is it possible to put anything other then text in NSComboBox popup?
  • Next by thread: Re: NSTreeController / NSOutlineView vs. sorting
  • Index(es):
    • Date
    • Thread