aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPFilterTableController.m8
1 files changed, 8 insertions, 0 deletions
diff --git a/Source/SPFilterTableController.m b/Source/SPFilterTableController.m
index dc1bf98a..60e67a04 100644
--- a/Source/SPFilterTableController.m
+++ b/Source/SPFilterTableController.m
@@ -165,6 +165,7 @@ static void *FilterTableKVOContext = &FilterTableKVOContext;
[self setFilterError:0 message:nil sqlstate:nil];
if(dataColumns) {
+ CGFloat totalWidth = 0;
// Add the new columns to the filterTable
for (NSDictionary *columnDefinition in dataColumns ) {
// Set up column for filterTable
@@ -175,6 +176,10 @@ static void *FilterTableKVOContext = &FilterTableKVOContext;
[filterDataCell setEditable:YES];
[filterDataCell setLineBreakMode:NSLineBreakByTruncatingTail]; // add ellipsis for long values (default is to simply hide words)
[filterCol setDataCell:filterDataCell];
+ NSSize headerSize = [[[filterCol headerCell] attributedStringValue] size];
+ CGFloat headerInitialWidth = headerSize.width + 5.0;
+ [filterCol setWidth:headerInitialWidth];
+ totalWidth += headerInitialWidth;
[filterTableView addTableColumn:filterCol];
[filterCol release];
@@ -184,6 +189,9 @@ static void *FilterTableKVOContext = &FilterTableKVOContext;
[NSMutableArray arrayWithObjects:@"", @"", @"", @"", @"", @"", @"", @"", @"", @"", nil], SPTableContentFilterKey,
nil] forKey:[columnDefinition objectForKey:@"datacolumnindex"]];
}
+
+ // if the width of all columns is still less than the width of the table view resize them uniformly once to take up all horizontal space
+ if(totalWidth < [[filterTableView enclosingScrollView] contentSize].width) [filterTableView sizeToFit];
}
[filterTableView reloadData];