From 477e9f85bea8839b5f85600690fe0ccf7295eb29 Mon Sep 17 00:00:00 2001 From: Randall Luecke Date: Thu, 6 Jan 2011 14:50:40 -0600 Subject: [PATCH] Fix for variable row heights when initial setup of the tableview had zero rows --- AppKit/CPTableView.j | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/AppKit/CPTableView.j b/AppKit/CPTableView.j index 5fea8224c..dff8e5c53 100644 --- a/AppKit/CPTableView.j +++ b/AppKit/CPTableView.j @@ -2053,18 +2053,17 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; if (!(_implementedDelegateMethods & CPTableViewDelegate_tableView_heightOfRow_)) var height = (_rowHeight + _intercellSpacing.height) * _numberOfRows; + else if ([self numberOfRows] === 0) + var height = 0; else { // if this is the fist run we need to populate the cache if ([self numberOfRows] !== _cachedRowHeights.length) [self noteHeightOfRowsWithIndexesChanged:[CPIndexSet indexSetWithIndexesInRange:CPMakeRange(0, [self numberOfRows])]]; - var heightObject = _cachedRowHeights[_cachedRowHeights.length - 1]; - - if (heightObject) + var heightObject = _cachedRowHeights[_cachedRowHeights.length - 1], height = heightObject.heightAboveRow + heightObject.height + _intercellSpacing.height; - else - height = 0; + } @@ -2082,6 +2081,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; [self setNeedsDisplay:YES]; } + /*! Scrolls the receiver vertically in an enclosing CPClipView so the row specified by rowIndex is visible.