From 523a40c4a1297c318a9632b1ab31dee2d2de1b00 Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 9 May 2018 08:59:07 +0200 Subject: Changed a method to match other classes implementation --- Source/SPTableContent.m | 4 ++-- Source/SPTableContentFilterController.h | 2 +- Source/SPTableContentFilterController.m | 32 ++++++++++++++++---------------- 3 files changed, 19 insertions(+), 19 deletions(-) (limited to 'Source') 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 -- cgit v1.2.3