Filtering
By default, the filtering functionality of the Telerik UI Grid for ASP.NET Core is disabled.
Getting Started
To control filtering in the Grid, use the Filterable
property.
@(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.OrderViewModel>()
.Name("Grid")
.Filterable() // Enable the Menu filter mode.
...
<kendo-grid name="Grid">
<filterable enabled="true" />
</kendo-grid>
Each Filterable
configuration of the columns allows the setting of a custom DataSource.
...
columns.Bound(e => e.LastName).Width(220).Filterable(ftb => ftb.Multi(true)
.DataSource(ds => ds.Read(r => r.Action("Unique", "Grid").Data("{ field: 'LastName' }")))
);
.ShowIndexes(true))
...
<columns>
<column field="LastName" width="220">
<filterable enabled="true" multi="true">
<datasource>
<transport>
<read url="@Url.Action("Unique","Grid")" data="{ field: 'LastName' }" />
</transport>
</datasource>
</filterable>
</column>
</columns>
Only columns bound to a field can be filterable. To enable filtering on a column bound to an object, bind the column to a field of that object.
Filter Modes
The Grid supports the following filter modes:
To set the desired filter mode, use the Filterable->Mode
property. You can enable checkbox list filtering in the filter menu of the Grid component by specifying the Multi(true)
setting for the relevant Grid columns.
...
columns.Bound(p => p.UnitsInStock).Width(140).Filterable(ftb => ftb.Multi(true).CheckAll(true));
...
<columns>
<column field="UnitsInStock" width="140">
<filterable enabled="true" multi="true" check-all="true" />
</column>
</columns>