• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Binding a to-many relationship into a table subview of NSCollectionItemView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Binding a to-many relationship into a table subview of NSCollectionItemView


  • Subject: Binding a to-many relationship into a table subview of NSCollectionItemView
  • From: Gustavo Pizano <email@hidden>
  • Date: Thu, 28 Apr 2011 15:35:06 +0200

Hello all.

I have been researching and I only found somebody who had the same problem, but the question went unsolved, so Im sorry if I ask again, I hope somebody can enlighten me.

I have a NSCollectionView and its respective NSCollectionViewItem,  also I have a NSTableView wich displays the properties of an Entity VERSION,  The NSCollecitonView contents its bound to the selectedObjects of this table, so one I select something (1 or more) I see that the view I designed for the NSCollectionViewItem appears with the properties of VERSION (which were bound to the NSCollectionViewItem as representedObject.number , etc).
Now problem is that VERSION has a to-many relation with a entity called FILES_PER_VERSION, and in the view of the NSCollectionViewItem need to display in a table the properties of this entity.

I have tried using directly IB bindings but that doesnt seem to work. So I subclassed NSCollectionViewController and add a NSArrayController as an ivar called representedToVersionFilesArrayController.

then in the setRepresentedObject Im doing the following:



-(void)setRepresentedObject:(id)representedObject{
    [super setRepresentedObject:representedObject];

    if([[representedObject entity].name isEqualToString:DPA_VERSION_KEY] ){
        NSLog(@"DP Analyzer >>> represented Object is kind of entity DPAVersionFile");
        DPAVersion * ver = (DPAVersion *)representedObject;
        NSLog(@"DP Analyzer >>>  Got version files ");
        self.representedToVersionFilesSet = [[NSArrayController alloc] init];
        [self.representedToVersionFilesSet setAutomaticallyPreparesContent:YES];
        [self.representedToVersionFilesSet setEntityName:DPA_FILE_VERSION_KEY];
        [self.representedToVersionFilesSet setManagedObjectContext:[(DP_AnalyzerAppDelegate *)[[NSApplication sharedApplication] delegate] managedObjectContext]];
        [self.representedToVersionFilesSet bind:@"contentSet" toObject:ver  withKeyPath:DPA_VERSION_TO_VERSION_FILES_KEY options:nil];

    }


}

and then in IB in the table with is inside the view of the NSCollectionViewController (or in this case my subclass of it), Im binding each table column to representedToVersionFilesArrayController.arrangedObjects.<property_of_FILES_PER_VERSION

results nothing yet, so i dunno what am i missing or doing really bad. I have checked that [ver valueForKey: DPA_VERSION_TO_VERSION_FILES_KEY] is returning me an NSSet with the entities related to ver, so there is data, but I hadn't been able to bind it to the table.

Any suggestions?
Please ?

thx

Gustavo

 _______________________________________________

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

  • Follow-Ups:
    • Re: Binding a to-many relationship into a table subview of NSCollectionItemView
      • From: Gustavo Pizano <email@hidden>
  • Prev by Date: Re: Stack of NSWindow sheets
  • Next by Date: Re: Aliases with NDAlias not appearing where I tell them to be.
  • Previous by thread: Re: Accessing NSWIndowController attribute from a subview in IB
  • Next by thread: Re: Binding a to-many relationship into a table subview of NSCollectionItemView
  • Index(es):
    • Date
    • Thread