aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax <dmoagx@users.noreply.github.com>2018-05-13 03:10:07 +0200
committerMax <dmoagx@users.noreply.github.com>2018-05-13 03:10:07 +0200
commit31a9b3b3510d15a5bb8820629eee20bb1303fa16 (patch)
treee86708a7e10de496483e8a2eeefe1cba50491adb
parent375faa0de3189a380cc03b8f70df232ec8df7346 (diff)
downloadsequelpro-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
-rw-r--r--Interfaces/English.lproj/FilterTableWindow.xib4
-rw-r--r--Source/SPFilterTableController.m8
2 files changed, 10 insertions, 2 deletions
diff --git a/Interfaces/English.lproj/FilterTableWindow.xib b/Interfaces/English.lproj/FilterTableWindow.xib
index 79da4153..384ec859 100644
--- a/Interfaces/English.lproj/FilterTableWindow.xib
+++ b/Interfaces/English.lproj/FilterTableWindow.xib
@@ -51,7 +51,7 @@
<rect key="frame" x="0.0" y="23" width="752" height="119"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
- <tableView identifier="AdvancedFilterTableView" verticalHuggingPriority="750" allowsExpansionToolTips="YES" selectionHighlightStyle="sourceList" alternatingRowBackgroundColors="YES" emptySelection="NO" autosaveColumns="NO" headerView="eWi-Z3-2Sr" id="8SC-Fh-D9L" customClass="SPCopyTable">
+ <tableView identifier="AdvancedFilterTableView" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="none" selectionHighlightStyle="sourceList" alternatingRowBackgroundColors="YES" emptySelection="NO" autosaveColumns="NO" headerView="eWi-Z3-2Sr" id="8SC-Fh-D9L" customClass="SPCopyTable">
<rect key="frame" x="0.0" y="0.0" width="752" height="119"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<size key="intercellSpacing" width="3" height="2"/>
@@ -240,7 +240,7 @@
<action selector="toggleLookAllFieldsMode:" target="-2" id="S7l-Cy-VFb"/>
</connections>
</button>
- <button toolTip="Clear all Filter Criterias (⌘⌫)" verticalHuggingPriority="750" id="egJ-46-zsK">
+ <button toolTip="Clear all Filter Criteria (⌘⌫)" verticalHuggingPriority="750" id="egJ-46-zsK">
<rect key="frame" x="452" y="12" width="143" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
<buttonCell key="cell" type="push" title="Clear" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="0Ec-f2-4N5">
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];