Подтвердить что ты не робот

Как изменить оператор фильтра по умолчанию в kendo ui grid mvc

Мне удалось изменить порядок фильтра по умолчанию для сетки Kendo, используя:

.Filterable(filterable => filterable
                        .Extra(true)
                        .Operators(ops => 
                            ops.ForString(str => str.Clear()
                                                    .Contains("Contains")
                                                    .StartsWith("Starts with")
                                                    .EndsWith("Ends with")
                                                    .IsEqualTo("Is equal to"))
                        ))

Можно ли изменить оператор по умолчанию на OR?

enter image description here

4b9b3361

Ответ 1

Это можно сделать с помощью события filterMenuInit:

 /* grid configuration snip */
.Events(e => e.FilterMenuInit("filterMenuInit"))
 /* grid configuration snip */

 <script>
 function filterMenuInit(e) {
      e.container
         .find("select.k-filter-and")
         .data("kendoDropDownList")
         .value("or");
 }
 </script>

Вот живая демонстрация: http://jsbin.com/etItEpi/1/edit

Ответ 2

Вы также можете сделать это на основе столбца в определении сетки (MVC):

cols.Bound(m => m.xxx).Filterable(f=> f.Cell(cell => cell.Operator("or")));