diff options
author | Max <dmoagx@users.noreply.github.com> | 2018-05-13 03:10:07 +0200 |
---|---|---|
committer | Max <dmoagx@users.noreply.github.com> | 2018-05-13 03:10:07 +0200 |
commit | 31a9b3b3510d15a5bb8820629eee20bb1303fa16 (patch) | |
tree | e86708a7e10de496483e8a2eeefe1cba50491adb /Source | |
parent | 375faa0de3189a380cc03b8f70df232ec8df7346 (diff) | |
download | sequelpro-31a9b3b3510d15a5bb8820629eee20bb1303fa16.tar.gz sequelpro-31a9b3b3510d15a5bb8820629eee20bb1303fa16.tar.bz2 sequelpro-31a9b3b3510d15a5bb8820629eee20bb1303fa16.zip |
Fix the issue with the advanced filter table not being usable for tables with many columns
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPFilterTableController.m | 8 |
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]; |