当筛选器列表完成时,Kendo Grid MVC不遵守筛选器顺序

问题描述 投票:0回答:1

我按照Elsimer提供的解决方案:Kendo Grid MVC: default filter for string fields is set to "is equal to"

我收到了将Contains移动到列表顶部的请求,因此它是默认过滤器。所以我设置Filterable()如下:

.Filterable(filterable => filterable
    .Extra(false)
    .Operators(ops => ops
          .ForString(str => str.Clear()
                  .Contains("Contains")
                  .IsEqualTo("Is equal to")
                  .IsNotEqualTo("Is not equal to")
                  .StartsWith("Starts with")
                  .EndsWith("Ends with")
                  .DoesNotContain("Does not contain")
                  .IsNull("Is null")
                  .IsNotNull("Is not null")
                  .IsEmpty("Is empty")
                  .IsNotEmpty("Is not empty")
                  )))

不幸的是,这对订单或默认过滤器没有任何作用。但是,如果我只删除一个选项以使筛选器列表不完整(可以是任何选项,例如IsEmpty),那么所有内容都会以正确的顺序显示。

例如,随着IsEmpty的消失:

.Filterable(filterable => filterable
    .Extra(false)
    .Operators(ops => ops
          .ForString(str => str.Clear()
                  .Contains("Contains")
                  .IsEqualTo("Is equal to")
                  .IsNotEqualTo("Is not equal to")
                  .StartsWith("Starts with")
                  .EndsWith("Ends with")
                  .DoesNotContain("Does not contain")
                  .IsNull("Is null")
                  .IsNotNull("Is not null")
                  .IsNotEmpty("Is not empty")
                  )))
kendo-ui kendo-grid kendo-asp.net-mvc
1个回答
0
投票

欢迎来到剑道迷人的世界! :D我在2016年10月遇到了同样的问题。这是支持回复的内容:

这是因为,当所有操作符都存在时,使用默认顺序。这就是网格过滤器序列化的实现方式。

您唯一合理的选择是跳过至少一个过滤器运算符。

© www.soinside.com 2019 - 2024. All rights reserved.