Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDictionaryController with NSTableView and sorting of numeric data



It would seem that NSDictionaryController keys have to be strings.
So the sorting of numeric string keys is always going to be alphabetic.

My solution was to discard NSDictionaryController and create a proxy object containing two properties:

id key;
id value;

I looped through my dictionary creating proxy objects for each key and value and added each proxy object to an NSArray.
The array was then bound to my NSTableView.


Jonathan


Hello list

I have bound an NSDictionaryController to an NSTableView.
The keys in my bound dictionary are numeric strings 1... n
The dictionary keys and values display okay but the sorting of the key column is not numeric but alphabetic.
The value column sorts fine for objects of type NSNumber.
I have tried using NSNumber keys and an NSValueTransformer subclass but the controller seems to need an NSString key.


I know I am being dumb here. Please put me out of my misery.

Thanks

Jonathan


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >NSDictionaryController with NSTableView and sorting of numeric data (From: "email@hidden" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.