Client filtering not searching templated text

1 Answer 45 Views
DropDownList
Chris
Top achievements
Rank 2
Chris asked on 17 Jun 2022, 01:06 PM

Hi,

I have a dropdown list (ASP.NET Core v2021.2.511) that I have enabled filtering on using a contains filter. The list is bound but contains only a small number of rows, therefore Server filtering seemed to be overkill.

What is happening is this:

GLCode: H120

Description: Tuition Direct - Running Expenses

Templated text: Tuition Direct - Running Expenses (H120)

Search Text Examples:

  • H120 - no results found
  • tuit - item found

From this is appears that with client filtering that only the text in the DataTextField and not the result of the templated value is searched.

Is this by design or is it a bug ?

Shared View Code:

@model GeneralLedgerAccounts

@(Html.Kendo().DropDownListFor(m => m)
            .DataValueField("GLCode")
            .DataTextField("Description")
            .OptionLabel("Choose a GL Code ...")
            .Filter(FilterType.Contains)
            .BindTo((System.Collections.IEnumerable)ViewData["BudgetGLCodes"])
            .Template("#: data.Description # (#: data.GLCode #)")
)

Many Thanks

Chris

1 Answer, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 22 Jun 2022, 08:53 AM

Hi Chris,

Thank you for the provided information, explanation, and code snippet.

In general, the DropDownList widget is designed to filter the items based on the defined DataTextField upon client filtering. When a template has been utilized, the widget does not have knowledge of what is happening within it. Thus, it falls outside of its control.

Having this in mind, the reported behavior is expected, as the widget would not be able to search based on the defined template, as it is rather a formatted text that the widget does not explicitly work with.

Regardless, we have a dedicated knowledge base article that illustrates how the DropDownList can be filtered based on multiple fields. You can review it here:

For your convenience, here is a Telerik REPL example that illustrates this approach.

I hope this helps.

Best Regards,
Alexander
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
DropDownList
Asked by
Chris
Top achievements
Rank 2
Answers by
Alexander
Telerik team
Share this question
or