From da91ab98798c8463802095d544896bde7b0e8731 Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Sun, 14 Oct 2012 19:31:53 +0100 Subject: [PATCH] Fixed: implicitly set `selectionIndexes`. `CPTableView`'s `selectionIndexes` binding shouldn't be set automatically unless the content binding was also set automatically (through a table column binding). Assume that manual content binding implies a desire to manually bind selection indexes (and sort descriptors) as well. --- AppKit/CPTableView.j | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/AppKit/CPTableView.j b/AppKit/CPTableView.j index 63dd07483..041b79a48 100644 --- a/AppKit/CPTableView.j +++ b/AppKit/CPTableView.j @@ -4794,10 +4794,14 @@ Your delegate can implement this method to avoid subclassing the tableview to ad _contentBindingExpicitelySet = NO; } - if ([[self infoForBinding:@"selectionIndexes"] objectForKey:CPObservedObjectKey] !== destination) - [self bind:@"selectionIndexes" toObject:destination withKeyPath:@"selectionIndexes" options:nil]; + // If the content binding was set manually assume the user is taking manual control of establishing bindings. + if (!_contentBindingExpicitelySet) + { + if ([[self infoForBinding:@"selectionIndexes"] objectForKey:CPObservedObjectKey] !== destination) + [self bind:@"selectionIndexes" toObject:destination withKeyPath:@"selectionIndexes" options:nil]; - //[self bind:@"sortDescriptors" toObject:destination withKeyPath:@"sortDescriptors" options:nil]; + //[self bind:@"sortDescriptors" toObject:destination withKeyPath:@"sortDescriptors" options:nil]; + } } - (void)bind:(CPString)aBinding toObject:(id)anObject withKeyPath:(CPString)aKeyPath options:(CPDictionary)options