Completed
Last Updated: 13 Oct 2020 18:48 by ADMIN
Release 2020.R3.SP.next
Bryan Patrick
Created on: 18 Sep 2020 11:36
Category: Filter
Type: Bug Report
2
Operators' order is ignored in Core Filter Htm Helper

Bug report

Filter component operators are always rendered in the initial order, regardless of the specified order

Reproduction of the problem

This code:

.Fields(f =>
      {
          f.Add(p=>p.FirstName).Operators(o =>
                o.String(n =>n
                    .Contains("Contains")
                    .Eq("Is equal to")
                    .Custom("john", c => c.Text("John").Handler("oddNumbersHandler"))
                    )
                );

Renders to this:

Expected/desired behavior
The order of the operators shall be in the predefined order.

Environment
Kendo UI version: [all]
Browser: [all]

5 comments
ADMIN
Nikolay
Posted on: 02 Oct 2020 08:26

Hello,

I have logged a separate item so Default Operator is added for the Filter's fields. The order of the Filter operators and the default operators are different by their nature and require different items.

Its progress can be tracked at the below links:

Regards,
Nikolay
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Aaron
Posted on: 25 Sep 2020 13:23

I would also like to add that the behavior when specifying operators for the Filter control is inconsistent with the behavior when specifying operators for the Grid control. See this post for examples.

In summary, when specifying filter operators for the Grid control, the operators are rendered in the order they are listed in the code (the first one listed being the default). For the Filter control, on the other hand, the order that the filters are listed in the code is ignored. I'm not the OP, but I believe if operators for the Filter component worked the same way that they do for the Grid component, this would resolve OP's issue (as well as mine).

Bryan Patrick
Posted on: 25 Sep 2020 11:57

Yes.

If I select the FirstName field, I want the default operator for that row to be "Contains", regardless if I change from a different field, or am adding a new row to the filter control (more important).

Idealy I could have a "DefaultOperator" for the "FieldName" field that will be used when a new row is added or the field changed back to "FirstName".  That way I don't have to explicitly list every operator for every field that I want to default to "Contains".  

It should at least honor the explicit list I'm giving for the field for NEW rows.  If they change from FirstName to something and then back to FirstName, I'm not as concerned with it changing back to Contains (although would be nice).

 

Thank you.

 

 

ADMIN
Alex Hajigeorgieva
Posted on: 25 Sep 2020 08:21

Hi, Bryan,

Thank you very much for taking the time to report this.

I will paste the response given in the support thread on the same topic by my colleague Nikolay:

=====================

The initial filter value and the default operator is provided in the FilterExpression property:

.FilterExpression(f =>
      {
          f.Add(p => p.FirstName).Contains("Jeremy");
      })
 The above renders the Contains operator initially but if you change the field and return back to the FirstName field the operator is no longer Contains. Is that what you are referring to?

=======================

Kind Regards,
Alex Hajigeorgieva
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Bryan Patrick
Posted on: 18 Sep 2020 12:58

 

If it's not possible to do the above, can we have a "DefaultOperator" like you have a "DefaultValue".  I'd prefer the default to be "Contains", not "Equal To" for many text field searches (like "Address, Name,...")