I have managed to change the default filter order for the Kendo Grid using:
.Filterable(filterable => filterable
.Extra(true)
.Operators(ops =>
ops.ForString(str => str.Clear()
.Contains("Contains")
.StartsWith("Starts with")
.EndsWith("Ends with")
.IsEqualTo("Is equal to"))
))
Is there any way I can change the default operator to OR?
Solution. On the dataBound event of the grid, find the filter dropdown and select() the desired default filter option. On the filter event of the Grid, if the filter is cleared, select the desired default filter option.
Returns the data item to which the specified table row is bound. The data item is a Kendo UI Model instance. When using the Grid's MVC wrapper, the Grid must be Ajax-bound for the dataItem() method to work.
pageable Boolean|Object (default: false) If set to true the grid will display a pager. By default paging is disabled. Can be set to a JavaScript object which represents the pager configuration. Don't forget to set a pageSize, no matter if paging is performed client-side or server-side.
This can be done via the filterMenuInit event:
/* 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>
Here is a live demo: http://jsbin.com/etItEpi/1/edit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With