• 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
Re: TableView displaying a zillion empty rows
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: TableView displaying a zillion empty rows


  • Subject: Re: TableView displaying a zillion empty rows
  • From: Andy Lee <email@hidden>
  • Date: Wed, 08 Jul 2009 03:31:16 -0400

-(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 (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: TableView displaying a zillion empty rows
      • From: Mac First <email@hidden>
    • Re: TableView displaying a zillion empty rows
      • From: Quincey Morris <email@hidden>
References: 
 >TableView displaying a zillion empty rows (From: Brian Hughes <email@hidden>)
 >Re: TableView displaying a zillion empty rows (From: Florian Soenens <email@hidden>)

  • Prev by Date: Re: TableView displaying a zillion empty rows
  • Next by Date: Re: TableView displaying a zillion empty rows
  • Previous by thread: Re: TableView displaying a zillion empty rows
  • Next by thread: Re: TableView displaying a zillion empty rows
  • Index(es):
    • Date
    • Thread