Sorting a column in a Table View
Sorting a column in a Table View
- Subject: Sorting a column in a Table View
- From: Julio Cesar Silva dos Santos <email@hidden>
- Date: Fri, 15 Jul 2005 22:05:30 -0300
I have been searching the list archives but I have not found an
answer that fits my needs. That is the problem:
//Load the data into the dictionary
NSMutableDictionary * mutable = [NSDictionary
dictionaryWithContentsOfFile:@"/the/file"];
//Get the names of every entry in the dictionary (I need this because
every
//entry of the dictionary is a dictionary
NSArray * names = [mutable allKeys];
//Populate the table
- (id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn
row:(int)rowIndex
{
return [[mutable objectForKey:[names objectAtIndex:rowIndex]]
objectForKey:[aTableColumn identifier]];
}
The question is: Should I sort mutable before populating the table
(in awakeFromNib)? Or should I use Sort Key and Sort Selector of the
columns in Table View?
I could not find a way to sort an NSDictionary so I think it is
better use the second option but I am not sure how the Sort Selector
method should be implemented.
Thanks for any help,
Julio Cesar Santos
email@hidden
eMac 1GHz ComboDrive
640MB RAM
Linux User #359973
_______________________________________________
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