Skip navigation.
 
mlbest way to sort an NSOutlineView?
FROM : Daniel Morrow
DATE : Fri Oct 15 21:33:33 2004

I have an NSOutlineView, one of the columns is expandable (obviously).

Anyway, when I click on the header of the column, I'd like it to sort,
but I'd also like the any expanded items to sort, too.

Right now, I have a delegate - outlineView:sortDescriptorsDidChange,
that gets called whenever the sort order changes. I'm sorting my
mutable array of data, and then calling "reloadData" - but this
particular block of data only belongs to the top level of data, not
expanded items.

So, then I figure I could write a recursive routine which would
traverse my arrays, and sort each one of them. But this seemed like too
much coding, and the whole reason I got into Cocoa was to get more
done, with less code. (I'm new to cocoa btw).

So, is there a sample somewhere which shows how to do sorting on an
NSOutlineView that doesn't require a lot of code?

Thanks for any help in this matter,
-Dan.

Related mailsAuthorDate
No related mails found.