Re: Turning off sorting for one column of an NStableView
Re: Turning off sorting for one column of an NStableView
- Subject: Re: Turning off sorting for one column of an NStableView
- From: "Zef RosnBrick" <email@hidden>
- Date: Mon, 6 Aug 2007 13:20:06 -0500
I believe under the binding menu for the table column, there should be an
option to automatically generate sort descriptors, which is checked by
default. If you uncheck it, it should disable sorting for the table column.
On 8/6/07, António Nunes <email@hidden> wrote:
>
> Hi,
>
> I have an NSTableView whose columns are bound to an
> NSArrayController. Two of the three columns use a custom sort
> descriptor. The first column should not sort at all, so it's header
> should not be clickable. I have tried in vain to disable sorting for
> that column, but no luck. I did find a thread on this list with
> instructions for turning sorting off for all columns but didn't find
> a way to adapt that to my needs.
>
> It tried
> - (void)setSortDescriptorPrototype:(NSSortDescriptor *)sortDescriptor
>
> ...to set the prototype to nil since the documentation for that
> method states:
> > A table column is considered sortable if it has a sort descriptor
> > that specifies the sorting direction, a key to sort by, and a
> > selector defining how to sort.
> >
>
> so I would expect this to prevent sorting, but it doesn't.
>
> NSTableView provides
> - (void)tableView:(NSTableView *)tableView didClickTableColumn:
> (NSTableColumn *)tableColumn
>
> ... which is too late in the process, and doesn't disable clicking
> the header cell anyway.
>
> There is also
> - (void)tableView:(NSTableView *)tableView
> mouseDownInHeaderOfTableColumn:(NSTableColumn *)tableColumn
>
> ...which might be early enough in the process, but I don't know how
> to use this to disable clicking the header cell, since you can't e.g.
> return a boolean to indicate that you've handled the click, and thus
> prevent any further processing by the table view.
>
> I've tried the crude hack of putting a transparent object (e.g. an
> NSView) over the header cell, and that almost works except that it is
> not full-proof. Very occasionally a click leaks through to the
> underlying column header, which means that some users somewhere will
> have this happen to them. Feels like a bug to me, so unless someone
> alerts me to the contrary I'll file a bug report about this.
>
> I think I could create a sort selector that would cause the sort to
> have no effect, by using a sort descriptor for the relevant column
> that always returns kCFCompareEqualTo, but that still doesn't solve
> the issue of disabling clicking that particular column header.
>
> Any suggestions?
>
> Cheers,
> -António
>
> -----------------------------------------------
> Touch is a language without words
> -----------------------------------------------
>
>
>
>
> _______________________________________________
>
> 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
>
_______________________________________________
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