-(id) tableView: (NSTableView *) aTableView objectValueForTableColumn: (NSTableColumn *) aTableColumn row: (int) rowIndex
  {
          id returnValue = nil;
        
          if (aTableView == gameScoresTableView)
          {
LNPlayer *currentPlayer = [playersArray objectAtIndex: currentIndex_]; NSMutableArray *tempGameRecordsArray = [NSMutableArray arrayWithArray: [currentPlayer gameRecordsArray]];
                
                id theRecord, theValue;
                
                theRecord = [tempGameRecordsArray objectAtIndex:rowIndex];
                theValue = [theRecord objectForKey:[aTableColumn identifier]];
                
                returnValue = theValue;
          }
          else if (aTableView == playerManagementTableView)
          {
                //Which Player?
                LNPlayer *player = [playersArray objectAtIndex: rowIndex];
                //What is the value of the attribute named identifier?
                //returnValue = [player valueForKey: [aTableColumn identifier]];
                if ([[aTableColumn identifier] isEqualTo: @"firstName_"] == YES)
                        returnValue = [player firstName_];
                else if ([[aTableColumn identifier] isEqualTo: @"lastName_"])
                        returnValue = [player lastName_];
                else if ([[aTableColumn identifier] isEqualTo: @"playerName_"])
                        returnValue = [player playerName_];
else if ([[aTableColumn identifier] isEqualTo: @"trebleClefGameLevel_"]) returnValue = [NSNumber numberWithInt: [player trebleClefGameLevel_]]; else if ([[aTableColumn identifier] isEqualTo: @"altoClefGameLevel_"]) returnValue = [NSNumber numberWithInt: [player altoClefGameLevel_]]; else if ([[aTableColumn identifier] isEqualTo: @"tenorClefGameLevel_"]) returnValue = [NSNumber numberWithInt: [player tenorClefGameLevel_]]; else if ([[aTableColumn identifier] isEqualTo: @"bassClefGameLevel_"]) returnValue = [NSNumber numberWithInt: [player bassClefGameLevel_]]; else if ([[aTableColumn identifier] isEqualTo: @"symbolTextConcentrationGameLevel_"]) returnValue = [NSNumber numberWithInt: [player symbolTextConcentrationGameLevel_]];
          }
        
         return returnValue;
  }

Whoops, I didn't notice until Florian's message that you *did* post this code. If your table columns don't have the right identifiers, tableView:objectValueForTableColumn:row: returns nil, which results in an empty cell. So, to echo Quincy's question, what exactly "does not work"? Is your table displaying *empty* rows, or *no* rows? Is it possible your table columns aren't named what you think they are?

--Andy

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to