Filter dropdown by both numbers and alpha characters

We have a dynamically populated drop down list in a data grid element. The dropdown works and we're able to filter by alpha characters, but not the numerals that are in each option.

For instance, each option would look like "12D - Diver". We want to be able to filter by typing "diver", but not "12D".


Screenshot 2021-06-21 102525.png

I see where the placeholder content for the input element contains "Diver" and not "12D - Diver".

How do we implement this?

This is what the dropdown list looks like.

<SfDropDownList PopupWidth="400px"

                Placeholder="@(serviceAssignment.Emp.Title ?? "---")"

                TItem="Emp"

                TValue="Emp"

                Enabled="@(personnelCategory is not null && serviceCode is not null)"

                Value="serviceAssignment.Emp"

                ValueChanged="emp=>serviceAssignment.Emp = emp ?? serviceAssignment.Emp"

                DataSource="@empSubsets.GetValueOrDefault(lookupKey, new List<Emp>())">

    <DropDownListTemplates TItem="Emp">

        <ItemTemplate Context="itemContext">

            @{

                Emp sa = (itemContext as Emp);

            }

            @if (!string.IsNullOrEmpty(sa.Code))

            {

                <span>@(sa.Code + " - " + sa.Title)</span>

            }

        </ItemTemplate>

    </DropDownListTemplates>

    <DropDownListEvents TValue="Emp" TItem="Emp" OnOpen="(args)=>OnEmpOpenHandler((ServiceAssignment)context, args)" />

    <DropDownListFieldSettings Text="Title" Value="Code" />

</SfDropDownList>


1 Reply

BC Berly Christopher Syncfusion Team June 22, 2021 12:33 PM UTC

Hi Rick, 
  
Greetings from Syncfusion support. 
  
We can the requested requirement with help of predicate which is used to filter the value from the multiple fields. 
  
For your reference, we have attached the sample below. 
  
    public async Task OnFiltering(FilteringEventArgs args) 
    { 
        args.PreventDefaultAction = true; 
        var orWhere = WhereFilter.Or(new List<WhereFilter> { 
            new WhereFilter() { Field = "Text", Operator = "contains", value = args.Text, IgnoreCase = true }, 
            new WhereFilter() { Field = "ID", Operator = "contains", value = args.Text, IgnoreCase = true } 
        }); 
        var query = new Query().Where(orWhere); 
        query = !string.IsNullOrEmpty(args.Text) ? query : new Query(); 
        await ddlObj.Filter(data, query); 
    } 
 
  
  
Regards, 
Berly B.C 


Loader.
Up arrow icon