aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-10-10 15:23:16 +0000
committerrowanbeentje <rowan@beent.je>2009-10-10 15:23:16 +0000
commit74fc2c8744c57312282dd460d2a903f44e989f72 (patch)
tree73e5bdb05a95663360047558792b32159ff28631
parentace8285a1644f73c225e4ce87e1689ead37511b4 (diff)
downloadsequelpro-74fc2c8744c57312282dd460d2a903f44e989f72.tar.gz
sequelpro-74fc2c8744c57312282dd460d2a903f44e989f72.tar.bz2
sequelpro-74fc2c8744c57312282dd460d2a903f44e989f72.zip
- Allow link arrows for foreign key links to work when used on a column with a foreign key link within the same table - this improves compatibility for Issue #428.
-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];
+ }
}
}