aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/TableContent.m39
1 files changed, 27 insertions, 12 deletions
diff --git a/Source/TableContent.m b/Source/TableContent.m
index 1fa9d193..8df1bbc1 100644
--- a/Source/TableContent.m
+++ b/Source/TableContent.m
@@ -1109,19 +1109,34 @@
// Save existing scroll position and details
[spHistoryControllerInstance updateHistoryEntries];
- // Store the filter details to use when next loading the table
NSString *targetFilterValue = [[tableValues objectAtIndex:[theArrowCell getClickedRow]] objectAtIndex:dataColumnIndex];
- NSDictionary *filterSettings = [NSDictionary dictionaryWithObjectsAndKeys:
- [refDictionary objectForKey:@"column"], @"filterField",
- targetFilterValue, @"filterValue",
- ([targetFilterValue isNSNull]?@"IS NULL":nil), @"filterComparison",
- nil];
- [self setFiltersToRestore:filterSettings];
-
- // Attempt to switch to the new table
- if (![tablesListInstance selectTableOrViewWithName:[refDictionary objectForKey:@"table"]]) {
- NSBeep();
- [self setFiltersToRestore:nil];
+
+ // If the link is within the current table, apply filter settings manually
+ if ([[refDictionary objectForKey:@"table"] isEqualToString:selectedTable]) {
+ [fieldField selectItemWithTitle:[refDictionary objectForKey:@"column"]];
+ [self setCompareTypes:self];
+ if ([targetFilterValue isNSNull]) {
+ [compareField selectItemWithTitle:@"IS NULL"];
+ } else {
+ [argumentField setStringValue:targetFilterValue];
+ }
+ [self filterTable:self];
+
+ } else {
+
+ // Store the filter details to use when loading the target table
+ NSDictionary *filterSettings = [NSDictionary dictionaryWithObjectsAndKeys:
+ [refDictionary objectForKey:@"column"], @"filterField",
+ targetFilterValue, @"filterValue",
+ ([targetFilterValue isNSNull]?@"IS NULL":nil), @"filterComparison",
+ nil];
+ [self setFiltersToRestore:filterSettings];
+
+ // Attempt to switch to the target table
+ if (![tablesListInstance selectTableOrViewWithName:[refDictionary objectForKey:@"table"]]) {
+ NSBeep();
+ [self setFiltersToRestore:nil];
+ }
}
}