This question is locked. New answers and comments are not allowed.
Ferdinando
Top achievements
Rank 1
Ferdinando
asked on 22 Mar 2016, 08:48 AM
Hi,
Is it possible to hide the suggestions view when no items are found?
3 Answers, 1 is accepted
0
Accepted
Hi Ferdinando,
Yes, you can hide the suggestion list when there are no matching items.
In order to do this you should conform to the TKAutoCompleteDelegate protocol and implement the autocomplete:willShowSuggestionList: method. This method provides you with the array of matches according to the input. You should check if there are any matches and in case there are no matches you should hide the suggestions list. Consider the following code snippet.
Regards,
Sophi
Telerik
Yes, you can hide the suggestion list when there are no matching items.
In order to do this you should conform to the TKAutoCompleteDelegate protocol and implement the autocomplete:willShowSuggestionList: method. This method provides you with the array of matches according to the input. You should check if there are any matches and in case there are no matches you should hide the suggestions list. Consider the following code snippet.
-(void)autoComplete:(TKAutoCompleteTextView *)autocomplete willShowSuggestionList:(NSArray<
__kindof
TKAutoCompleteToken *> *)suggestionList
{
if (suggestionList.count == 0) {
autocomplete.suggestionView.hidden = YES;
}
}
Regards,
Sophi
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items
0
Miguel
Top achievements
Rank 1
answered on 15 Apr 2016, 10:10 AM
With 2015.3.1105 framework version I get always a suggestionList.count = 0 in this delegate function, even when there are matching items.
¿Any work around?
0
Miguel
Top achievements
Rank 1
answered on 15 Apr 2016, 10:43 AM
I found it myself.
-(void)autoComplete:(TKAutoCompleteTextView *)autocomplete willShowSuggestionList:(NSArray<
__kindof
TKAutoCompleteToken *> *)suggestionList
{
NSInteger items = ((TKSuggestionListView*)autocomplete.suggestionView).items.count;
if (items == 0) {
autocomplete.suggestionView.hidden = YES;
} else {
autocomplete.suggestionView.hidden = NO;
}
}