diff options
author | Max <dmoagx@users.noreply.github.com> | 2018-05-09 08:59:07 +0200 |
---|---|---|
committer | Max <dmoagx@users.noreply.github.com> | 2018-05-09 09:11:17 +0200 |
commit | 523a40c4a1297c318a9632b1ab31dee2d2de1b00 (patch) | |
tree | ab5f9fcf3c64e4514c0b5f11de2ba1f9c6cba0ab | |
parent | 1838bb50da412fc3875aeb95ab082a9721000efc (diff) | |
download | sequelpro-523a40c4a1297c318a9632b1ab31dee2d2de1b00.tar.gz sequelpro-523a40c4a1297c318a9632b1ab31dee2d2de1b00.tar.bz2 sequelpro-523a40c4a1297c318a9632b1ab31dee2d2de1b00.zip |
Changed a method to match other classes implementation
-rw-r--r-- | Source/SPTableContent.m | 4 | ||||
-rw-r--r-- | Source/SPTableContentFilterController.h | 2 | ||||
-rw-r--r-- | Source/SPTableContentFilterController.m | 32 |
3 files changed, 19 insertions, 19 deletions
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index 8d1a19a3..da4fea05 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -361,7 +361,7 @@ static void *TableContentKVOContext = &TableContentKVOContext; [filterButton setEnabled:NO]; [toggleRuleFilterButton setEnabled:NO]; [toggleRuleFilterButton setState:NSOffState]; - [filterControllerInstance updateFiltersFrom:self]; + [filterControllerInstance setColumns:nil]; // Disable pagination [paginationPreviousButton setEnabled:NO]; @@ -636,7 +636,7 @@ static void *TableContentKVOContext = &TableContentKVOContext; [filterTableController setColumns:dataColumns]; // Enable and initialize filter fields (with tags for position of menu item and field position) - [filterControllerInstance updateFiltersFrom:self]; + [filterControllerInstance setColumns:dataColumns]; // Restore preserved filter settings if appropriate and valid [filterControllerInstance restoreSerializedFilters:filtersToRestore]; //if we did restore some filters, set filtering enabled diff --git a/Source/SPTableContentFilterController.h b/Source/SPTableContentFilterController.h index 6c7f3fbb..24935d2a 100644 --- a/Source/SPTableContentFilterController.h +++ b/Source/SPTableContentFilterController.h @@ -65,7 +65,7 @@ NSString * const SPTableContentFilterHeightChangedNotification; */ - (void)focusFirstInputField; -- (void)updateFiltersFrom:(SPTableContent *)tableContent; +- (void)setColumns:(NSArray *)dataColumns; - (void)openContentFilterManagerForFilterType:(NSString *)filterType; diff --git a/Source/SPTableContentFilterController.m b/Source/SPTableContentFilterController.m index ef11b3d3..0f928439 100644 --- a/Source/SPTableContentFilterController.m +++ b/Source/SPTableContentFilterController.m @@ -437,7 +437,7 @@ static void _addIfNotNil(NSMutableArray *array, id toAdd); return NO; } -- (void)updateFiltersFrom:(SPTableContent *)tableContent +- (void)setColumns:(NSArray *)dataColumns; { [self willChangeValueForKey:@"model"]; // manual KVO is needed for filter rule editor to notice change [model removeAllObjects]; @@ -446,22 +446,22 @@ static void _addIfNotNil(NSMutableArray *array, id toAdd); [columns removeAllObjects]; //without a table there is nothing to filter - if(![tableContent selectedTable]) return; - - //sort column names if enabled - NSArray *columnDefinitions = [tableContent dataColumnDefinitions]; - if([[NSUserDefaults standardUserDefaults] boolForKey:SPAlphabeticalTableSorting]) { - NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"name" ascending:YES]; - columnDefinitions = [columnDefinitions sortedArrayUsingDescriptors:@[sortDescriptor]]; - } + if(dataColumns) { + //sort column names if enabled + NSArray *columnDefinitions = dataColumns; + if ([[NSUserDefaults standardUserDefaults] boolForKey:SPAlphabeticalTableSorting]) { + NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"name" ascending:YES]; + columnDefinitions = [columnDefinitions sortedArrayUsingDescriptors:@[sortDescriptor]]; + } - // get the columns - for(NSDictionary *colDef in columnDefinitions) { - ColumnNode *node = [[ColumnNode alloc] init]; - [node setName:[colDef objectForKey:@"name"]]; - [node setTypegrouping:[colDef objectForKey:@"typegrouping"]]; - [columns addObject:node]; - [node release]; + // get the columns + for (NSDictionary *colDef in columnDefinitions) { + ColumnNode *node = [[ColumnNode alloc] init]; + [node setName:[colDef objectForKey:@"name"]]; + [node setTypegrouping:[colDef objectForKey:@"typegrouping"]]; + [columns addObject:node]; + [node release]; + } } // make the rule editor reload the criteria |