FROM : Trygve Inda
DATE : Sun Nov 18 15:39:42 2007
I have an NSArrayController hooked to an array (of NSDictionary) and bound
to columns in a NSTableView. It all works fine. I added an auto save name to
the table so that the column widths and ordering are restored upon launch,
but can't get it to restore the sort order.
I can force a sort with:
NSMutableArray *descriptors = [NSMutableArray arrayWithCapacity:0];
NSSortDescriptor *descriptor;
descriptor=[[NSSortDescriptor alloc] initWithKey: @"name" ascending: YES
selector: @selector(compare:)];
[[myTableView tableColumnWithIdentifier:@"name"]
setSortDescriptorPrototype:descriptor];
[descriptors addObject:descriptor];
[descriptor release];
[myTableView setSortDescriptors:descriptors];
Of course this sorts by a fixed column. I was thinking I could call
sortDescriptors before quitting and save restore this using an NSData, but
really this should be automated.
How do do it?
Thanks,
Trygve
DATE : Sun Nov 18 15:39:42 2007
I have an NSArrayController hooked to an array (of NSDictionary) and bound
to columns in a NSTableView. It all works fine. I added an auto save name to
the table so that the column widths and ordering are restored upon launch,
but can't get it to restore the sort order.
I can force a sort with:
NSMutableArray *descriptors = [NSMutableArray arrayWithCapacity:0];
NSSortDescriptor *descriptor;
descriptor=[[NSSortDescriptor alloc] initWithKey: @"name" ascending: YES
selector: @selector(compare:)];
[[myTableView tableColumnWithIdentifier:@"name"]
setSortDescriptorPrototype:descriptor];
[descriptors addObject:descriptor];
[descriptor release];
[myTableView setSortDescriptors:descriptors];
Of course this sorts by a fixed column. I was thinking I could call
sortDescriptors before quitting and save restore this using an NSData, but
really this should be automated.
How do do it?
Thanks,
Trygve
| Related mails | Author | Date |
|---|---|---|
| Trygve Inda | Nov 18, 15:39 | |
| Keary Suska | Nov 20, 01:01 | |
| Trygve Inda | Nov 20, 13:18 | |
| Trygve Inda | Nov 20, 14:13 | |
| mmalc crawford | Nov 20, 14:40 |






Cocoa mail archive

