Hmmm. When I add a "nil" column test, the resulting table has the correct number of rows and group rows appear, but it wipes out all the data the cells are supposed to display. By that I mean the table cells are all empty and uneditable. Data only appears in the cells if I remove or comment out the "else if (columnIdentifier == nil)" block.

I noticed this a few weeks ago when I first started using tableView: dataCellForTableColumn: row: but couldn't figure out what was going on. It seems almost like the table renders twice. The first time it ignores your commands and just does whatever it wants and the second time it actually pays attention to the tests.

- (NSCell *) tableView:(NSTableView *) inTableView
        dataCellForTableColumn:(NSTableColumn *) inTableColumn
        row:(NSInteger) inRow
{
        NSString        *columnIdentifier               = [inTableColumn 
identifier],
*cellType = [[[testController arrangedObjects] objectAtIndex: inRow] objectForKey: @"cell_type"];
                
        if ([columnIdentifier isEqualToString: @"delete"])
        {
                NSLog(@"delete table column");
                return [cellType isEqualToString: @"project"] ? addCell : 
deleteCell ;
        }
        else if ([columnIdentifier isEqualToString: @"page_number"])
        {
                NSLog(@"page number table column");
return [cellType isEqualToString: @"project"] ? projectNameCell : pageNumberCell ;
        }
        else if ([columnIdentifier isEqualToString: @"master"])
        {
                NSLog(@"master table column");
return [cellType isEqualToString: @"project"] ? dummyCell : masterPageCell ;
        }
        /*else if ((inTableColumn == nil) || (columnIdentifier == nil))
        {
// if this block is commented out, the NSLogs in the above 3 blocks print and the cell data displays // if it is uncommented none of the cell data displays and all that logs to the console is "nil table column." The above 3 logs never print.
                NSLog(@"nil table column");
                return pageNumberCell;
        }*/
        else
                return [inTableColumn dataCellForRow: inRow];
}


On Feb 19, 2009, at 7:18 PM, Kyle Sluder wrote:

According to the documentation, group rows are treated in delegate
methods as belonging to a nil column.  You seem only to be testing for
actual columns.

Not entirely sure about the editing problem; you're making the cell
not editable, which is appropriate, but perhaps because you're
mistakenly returning the cell in response to a column request it's
using that column's editable property.

--Kyle Sluder

_______________________________________________

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