NSTableView with columns bound to different NSArrayControllers
- by Vyacheslav Karpukhin
i have NSTableView and two columns in it:
NSTableColumn *column = [[[NSTableColumn alloc] initWithIdentifier:@"custId"] autorelease];
[column bind:@"value" toObject:arrC2 withKeyPath:@"arrangedObjects.custId" options:nil];
[table addTableColumn:column];
column = [[[NSTableColumn alloc] initWithIdentifier:@"totalGrams"] autorelease];
[column bind:@"value" toObject:valuationArrC withKeyPath:@"arrangedObjects.totalGrams_double" options:nil];
[table addTableColumn:column];
as you can see, columns bound to different NSArrayControllers. first column shows correct values, but second just shows "(" symbol. but if i swap columns like this:
NSTableColumn *column = [[[NSTableColumn alloc] initWithIdentifier:@"totalGrams"] autorelease];
[column bind:@"value" toObject:valuationArrC withKeyPath:@"arrangedObjects.totalGrams_double" options:nil];
[table addTableColumn:column];
column = [[[NSTableColumn alloc] initWithIdentifier:@"custId"] autorelease];
[column bind:@"value" toObject:arrC2 withKeyPath:@"arrangedObjects.custId" options:nil];
[table addTableColumn:column];
then i see values of first column (which was second in the first example) and again "(" in the second column. i don't understand that behaviour. how can i bound two array controllers to one table?