How to add a Custom FilterOperator in the dropdown list of FilterField

1 Answer 17 Views
General Discussions
Top achievements
Rank 1
Fabrizio asked on 03 Mar 2022, 05:23 PM

Good morning all,

I'm taking a look to the new Filter component, recently added to Telerik UI for Blazor.

I'm using it to build conditions to send to a custom SQL Query generator which will build the where clauses mapping from the export of the filter component. You can see my previous question (edited after i figured out a way) here:

The main reason I'm writing you is because I need to add custom items in the list of operators.
Specifically to check an Item against a list, but it's irrelevant I just need an operator that would then be interpreted by the QueryBuilder, I don't need to integrate with other telerik components.

Can I extend some of Telerik classes to implement the functionality I need? Is there any way?

If this is possible in any other way, can you point me in the right direction?


Thank you very much

PS: I tagged this question as General Discussion as it seems like a "Filter" tag is not available yet.

Have a nice day!



Thanks, have a nice day.

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 08 Mar 2022, 08:42 AM

Hi Fabrizio,

Our Filter component is bound to a FilterDescriptor that support only the predefined set of filter operators (through the FilterOperator enum). The component is designed like this to integrate with our Telerik.DataSource. The purpose of our datasource is to facilitate our customers by performing queries on the data for filtering, sorting, etc. Thus, custom filtering operators in the Filter component are not supported out-of-the-box because it will break the integration with our datasource.

As you are serializing and building your own query generator, I think that there might be a potential workaround. You can customize the Operators collection through the parameter. In the collection you might use a built-in filter operator, but later replace it with the operator that you would like in the serialized json.

Below you can find our demos for custom operator list:

<TelerikFilter @bind-Value="@Value">
        <FilterField Name="FirstName" Type="typeof(string)" Label="First Name" Operators="@NameOperators" />

@code {
    public CompositeFilterDescriptor Value { get; set; } = new CompositeFilterDescriptor();

    public List<FilterListOperator> NameOperators { get; set; } = new List<FilterListOperator>()
        new FilterListOperator { Operator = FilterOperator.StartsWith, Text = "begins with" },
        new FilterListOperator { Operator = FilterOperator.EndsWith, Text = "ends with" }

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.

General Discussions
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question