GridFilterableSettingsBuilderBase
Methods
Enabled(System.Boolean)
Enables or disables filtering
Parameters
value - System.Boolean
True to set the Filterable functionality
Example
@(Html.Kendo().Grid<OrderViewModel>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.OrderID).Filterable(false);
columns.Bound(p => p.Freight);
})
.Filterable(f => f.Enabled(true))
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Orders_Read", "Grid"))
)
)
Operators(System.Action)
Configures the Filter menu operators.
Parameters
configurator - System.Action<FilterableOperatorsBuilder>
The text of the filter operators displayed in the filter menu.
Example
@(Html.Kendo().Grid<OrderViewModel>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.OrderID).Filterable(false);
columns.Bound(p => p.Freight);
})
.Filterable(filterable => filterable
.Extra(false)
.Operators(operators => operators
.ForString(str => str.Clear()
.StartsWith("Starts with")
.IsEqualTo("Is equal to")
.IsNotEqualTo("Is not equal to")
))
)
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Orders_Read", "Grid"))
)
)
Messages(System.Action)
Configures Filter menu messages.
Parameters
configurator - System.Action<FilterableMessagesBuilder>
Configure the options for the Messages in the Filter
Example
@(Html.Kendo().Grid<OrderViewModel>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.OrderID).Filterable(false);
columns.Bound(p => p.Freight);
})
.Filterable(f => f.Messages(m => m.And("And").Or("Or").Filter("Apply filter").Clear("Clear filter")))
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Orders_Read", "Grid"))
)
)
Extra(System.Boolean)
Specify if the extra input fields should be visible within the filter menu. Default is true.
Parameters
value - System.Boolean
True to show the extra inputs, otherwise false
Example
@(Html.Kendo().Grid<OrderViewModel>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.OrderID).Filterable(false);
columns.Bound(p => p.Freight);
})
.Filterable(f => f.Extra(false))
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Orders_Read", "Grid"))
)
)
Mode(Kendo.Mvc.UI.GridFilterMode)
Specify the filter mode - you can choose between having separate header row and the filter menu available by clicking the icon. Default is the filter menu. Multiple filter modes can be set by combining the flags:
Parameters
value - GridFilterMode
If set to Row the user would be able to filter via extra row added below the headers. By default filtering is using the Menu mode.
Example
@(Html.Kendo().Grid<OrderViewModel>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.OrderID).Filterable(false);
columns.Bound(p => p.Freight);
})
.Filterable(f => f.Mode(GridFilterMode.Menu))
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Orders_Read", "Grid"))
)
)