This is a migrated thread and some comments may be shown as answers.

Desciption not searching cause text path is set to another field.

1 Answer 35 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 23 Aug 2019, 08:53 AM

I have a customer filter that should be searching the description field as well but I think its not cause the text search path is set to reference how to do i get it so that it honours my path

 

/// Class CustomAutoCompleteViewFilter.
/// Implements the <see cref="Telerik.XamarinForms.Input.AutoComplete.IAutoCompleteFilter" />
/// </summary>
/// <seealso cref="Telerik.XamarinForms.Input.AutoComplete.IAutoCompleteFilter" />
public class CustomAutoCompleteViewFilter : IAutoCompleteFilter
{
    /// <summary>
    /// Filters the specified item.
    /// </summary>
    /// <param name="item">The item.</param>
    /// <param name="searchText">The search text.</param>
    /// <param name="completionMode">The completion mode.</param>
    /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
    public bool Filter(object item, string searchText, CompletionMode completionMode)
    {
        StockAutoCompleteInfo stock = (StockAutoCompleteInfo)item;
        string lowerReference = stock.Code.ToLower();
        string lowerDescription = stock.Description.ToLower();
        string lowerSearchText = searchText.ToLower();
        return lowerReference.Contains(lowerSearchText) || lowerDescription.Contains(lowerSearchText);
    }
}
}

 

<telerikInput:RadAutoCompleteView x:Name="txtCode" SuggestionViewHeight="300"  CompletionMode="StartsWith"  TextSearchPath="Reference" Watermark="Search for Bom here...">
    <telerikInput:RadAutoCompleteView.SuggestionItemTemplate>
        <DataTemplate>
            <ViewCell>
                <StackLayout Orientation="Vertical">
                    <Label Text="{Binding Reference}"/>
                    <Label Text="{Binding Description}"/>
                    <BoxView BackgroundColor="Black" HeightRequest="1"  HorizontalOptions="StartAndExpand"/>
                </StackLayout>
            </ViewCell>
        </DataTemplate>
    </telerikInput:RadAutoCompleteView.SuggestionItemTemplate>
</telerikInput:RadAutoCompleteView>
<telerikInput:RadButton x:Name="btnFindBom"  BackgroundColor="#343C41" TextColor="White"  Clicked="BtnGetBomInfo_Clicked"  Text="Find Bom"></telerikInput:RadButton>

 

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 23 Aug 2019, 11:30 AM

Hi David,

I've just replied to the other thread on the same matter, please check it at the link below:

https://www.telerik.com/forums/search-description-and-value#Lk69dG5VqEW4j7CnJSCeNA

Regards, Yana
Progress 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
Tags
AutoComplete
Asked by
David
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or