-(void) searchFieldChanged{
MPVTModelList *list = [[MPVTModelList alloc] initWithClass:[MassPOAssignmentModel class]];
[intersectionTableView selectRowIndexes:[NSIndexSet indexSetWithIndex:1] byExtendingSelection:NO];
// [searchIntersectionField setStringValue:[[[searchIntersectionField stringValue] stringByReplacingOccurrencesOfString:@"\\" withString:kMPVTBlankString] stringByReplacingOccurrencesOfString:@"\'" withString:kMPVTBlankString]];
[searchIntersectionField setStringValue:[searchIntersectionField stringValue]];
NSArray *array=[[NSArray alloc]init];
if([[[searchIntersectionField cell]placeholderString] isEqualToString:@"Pricing Org"]){
NSArray *tempArray=[[[searchIntersectionField stringValue] uppercaseString] componentsSeparatedByString:@","];
NSLog(@"tempArray %@",tempArray);
NSString * str=[[searchIntersectionField stringValue] uppercaseString];
NSLog(@"str is %@",str);
for(id item in tempArray ){
[intersectionTableView reloadData];
array=[[[self intersectionList]entities]filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"mpoPricingOrg.stringValue contains[cd] %@",item]];
NSLog(@" item is %@",item);
NSLog(@"insie if arr %@",array);
[list appendEntities:array];
NSLog(@"hello %@",[[searchIntersectionField cell]placeholderString]);
}
}
else{
NSLog(@"inside else");
array = [[self searchFieldController] updatePredicateWithFilterText:[searchIntersectionField stringValue] searchArray:[[self intersectionList] entities] searchTableView:intersectionTableView];
NSLog(@"in side else array %@",array);
[list appendEntities:array];
}
[self setIntersectionList:list];
[list release];
[intersectionTableView reloadData];
[intersectionTableView deselectAll:nil];
[super updatePlacard:intersectionTableView];
}
我在-(void)controltextDidEditing
中调用了此方法。但是当我进入"中国"过滤谓词工作正常。但是当我进入中国,巴西和#34;它只显示中国的记录,而不是巴西的记录。请建议一个更好的方法。