Using sort descriptors in Outline View

30 views Asked by At

I have a cell-based NSOutlineView. Its content is bound to a tree controller. The content array of the tree controller is bound to a NSArray. The array consists of my custom objects: `

@interface QAssetRowData : NSObject {
    
}

@property (strong) NSString *rowText;
@property (strong) NSString *completeAssetName;
@property (strong) NSString *statusText;
@property (assign) AssetUID assetUID;
@property (assign) NSInteger assetType;
@property (assign) BOOL isLeaf;
@property (strong) NSMutableArray *children;
@property (assign) BOOL enableRow;
@end`

I want to use sort descriptors to sort the contents of the outline view using the key = @“rowText” such that the Parent nodes get sorted first and their child nodes get sorted only within their siblings.

For example, I want the rows to appear as below:

Asset 1
Asset 2
Group 1:
    c
    d
Group 2:
    a
    b

How do I use sort descriptors to achieve this?

0

There are 0 answers