diff options
Diffstat (limited to 'Source/SPTableRelations.m')
-rw-r--r-- | Source/SPTableRelations.m | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Source/SPTableRelations.m b/Source/SPTableRelations.m index 5160448f..980b8d30 100644 --- a/Source/SPTableRelations.m +++ b/Source/SPTableRelations.m @@ -49,6 +49,7 @@ { if ((self = [super init])) { relationData = [[NSMutableArray alloc] init]; + prefs = [NSUserDefaults standardUserDefaults]; } return self; @@ -175,7 +176,8 @@ [addRelationTableBox setTitle:[NSString stringWithFormat:NSLocalizedString(@"Table: %@", @"Add Relation sheet title, showing table name"), [tablesListInstance tableName]]]; [columnPopUpButton removeAllItems]; - [columnPopUpButton addItemsWithTitles:[tableDataInstance columnNames]]; + NSArray *columnTitles = ([prefs boolForKey:SPAlphabeticalTableSorting])? [[tableDataInstance columnNames] sortedArrayUsingSelector:@selector(compare:)] : [tableDataInstance columnNames]; + [columnPopUpButton addItemsWithTitles:columnTitles]; [refTablePopUpButton removeAllItems]; @@ -559,7 +561,8 @@ // Add the valid columns if ([validColumns count] > 0) { - [refColumnPopUpButton addItemsWithTitles:validColumns]; + NSArray *columnTitles = ([prefs boolForKey:SPAlphabeticalTableSorting])? [validColumns sortedArrayUsingSelector:@selector(compare:)] : validColumns; + [refColumnPopUpButton addItemsWithTitles:columnTitles]; [refColumnPopUpButton setEnabled:YES]; [confirmAddRelationButton setEnabled:YES]; |