Skip to content
Permalink
Browse files

Fix the issue with the advanced filter table not being usable for tab…

…les with many columns
  • Loading branch information...
dmoagx committed May 13, 2018
1 parent 375faa0 commit 31a9b3b3510d15a5bb8820629eee20bb1303fa16
Showing with 10 additions and 2 deletions.
  1. +2 −2 Interfaces/English.lproj/FilterTableWindow.xib
  2. +8 −0 Source/SPFilterTableController.m
@@ -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">
@@ -165,6 +165,7 @@ - (void)setColumns:(NSArray *)dataColumns
[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 @@ - (void)setColumns:(NSArray *)dataColumns
[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 @@ - (void)setColumns:(NSArray *)dataColumns
[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];

0 comments on commit 31a9b3b

Please sign in to comment.
You can’t perform that action at this time.