Binding NSTableView inside NSCollectionView

271 Views Asked by At

I have been able to successfully bind my view to an NSCollectionView, however my model is not binding to the view itself correctly. My model contains a few properties:

@interface MPReportBuilderCustomReportFilter : NSObject


@property (assign) MPReportBuilderTableColumnRecord *column;
@property (assign) NSString *columnName;
@property (retain) NSMutableArray *dataArray;
@property (assign) NSArrayController *dataArrayController;

-(id)initWithTableColumn:(MPReportBuilderTableColumnRecord *)column;
-(void)loadDataArray;

@end

I was able to programmatically bind an array controller in my model class and it would bind successfully to the data array:

@implementation MPReportBuilderCustomReportFilter

-(id)initWithTableColumn:(MPReportBuilderTableColumnRecord *)column
{
    self = [super init];
    if (self) {

        self.column = column;
        self.columnName = self.column.columnName;
        self.dataArray = [[[NSMutableArray alloc] init] autorelease];
        self.dataArrayController = [[NSArrayController alloc] initWithContent:nil];
        [self.dataArrayController bind:@"contentArray" toObject:self withKeyPath:@"dataArray" options:nil];

        [self loadDataArray];
    }
    return self;
}

I was able to successfully bind my array of models to the NSCollectionView which draws the views, however each individual view I want to bind the model's NSMutableArray to the NSTableView in the view. I don't think there is a way to do this programmatically because you are binding to Collection View Item.representedObject. I don't think you could do Collection View Item.representedObject.dataArrayController.arragnedObjects?

0

There are 0 best solutions below