Sorting NSTableView columns using new Panther methods
Sorting NSTableView columns using new Panther methods
- Subject: Sorting NSTableView columns using new Panther methods
- From: zeno <email@hidden>
- Date: Sun, 28 Dec 2003 02:35:24 +0100
*** Essential question:
Can anyone tell us, step by step, what we need to do to sort an
NSTableView column (like in Mail or iTunes) using the new "sort
descriptors" methods available in OSX 10.3 and the new "Sort Key",
"Sort Selector" and "Sort Order" parameters that we find in the new IB
that comes with the Xcode tools ?
*** Details and what I already know (for the ones who have more time):
I've read the last AppKit.html (
file:///Developer/Documentation/ReleaseNotes/Cocoa/AppKit.html ) and I
understood that with the new IB we can automatically manage the columns
sorting at least from a "GUI point of view"; in fact, if we
double-click an NSTableView in IB, select a column, then we inspect its
Attributes and fill out the "Sort Key" textfield (leave for ex.
"compare:" as "Sort Selector" and "Ascending" as "Sort Order"
parameters) the sorting UI implementation is practically done: no more
need to call the "tableView:didClickTableColumn:" method of the
NSTableView's delegate, test the sorting order (asc./desc.) and set the
"triangle indicator image" calling the [NSImage imageNamed:
@"NSAscendingSortIndicator"] or [NSImage imageNamed:
@"NSDescendingSortIndicator"] as we did in Jaguar. Those things are
automatically done now.
Now, what I need to understand, is what code I have to add (I suppose
to the table datasource) to get the sorting actually working.
Do I have to specify a sort descriptor as explained here:
http://developer.apple.com/documentation/Cocoa/Conceptual/
SortDescriptors/index.html ?
Do I have to define a sortDescriptorPrototype as explained in the
AppKit.html or is it automatically done from IB ?
Do I have to implement the "tableView:sortDescriptorsDidChange:" method
of NSTableDataSource ?
Do I have to use some of the IB "Bindings" (from the "Show Info" panel)
of the NSTableView ?
I'm confused. Sorry
;-)
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.