Re: NSTableView sort with a data source (silly question ?)
Re: NSTableView sort with a data source (silly question ?)
- Subject: Re: NSTableView sort with a data source (silly question ?)
- From: vincent habchi <email@hidden>
- Date: Mon, 3 May 2010 17:14:02 +0200
Le 3 mai 2010 à 17:08, Graham Cox a écrit :
>> this might be a silly question but, before doing any further implementation, and having found no definite answer, I dare ask it. Is there a way to sort the contents of a NSTableView whose data is provided by a data source, besides sorting at the source itself (via a suitable query)?
>
> You provide sorted data to the table through the data source.
Ok, that's what I was prepared to do.
> But the table can provide sort descriptors back to you to do this, allowing you to click table headers to pick how the data is sorted. Since the table is a view, of course it is your responsibility to provide the data in a sorted form. Responding to a change in sort descriptors and then actually performing a sort is two lines of code.
Well, ideally yes. In my case, it involves adding the selector to respond to the click, and append an auxiliary clause to a SQL request (SORT BY xxx ASC/DESC) and reload data. It's not two lines, but I agree it is not much work either.
Thanks for confirming my opinion!
Vincent_______________________________________________
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:
This email sent to email@hidden