1. GridFilterMode.Row
@(Html.Kendo().Grid(this.Model.ToList()).Columns(columns =>
{
columns.Bound(c => c.AccountCode).Filterable(ftb => ftb.Cell(cell => cell.Operator("startswith")));
columns.Bound(c => c.AccountName).Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")));
columns.Bound(c => c.AccountType.AccountTypeName).Filterable(flt => flt.Cell(cell => cell.Template("accountTypeFilterTemplate")));
})
.Filterable(ftb => ftb.Mode(GridFilterMode.Row))
)
}
2. GridFilterMode.Menu
@(Html.Kendo().Grid(this.Model.ToList()).Columns(columns =>
{
columns.Bound(c => c.AccountCode)
.Filterable(ftb => ftb.Operators(op => op.ForString(str => str.Clear()
.StartsWith("Starts with")
.Contains("Contains")
.DoesNotContain("Does not contain")
.IsEqualTo("Is equal to")
.IsNotEqualTo("Is not equal to")
.EndsWith("Ends with "))));
columns.Bound(c => c.AccountName)
.Filterable(ftb => ftb.Operators(op => op.ForString(str => str.Clear()
.Contains("Contains")
.DoesNotContain("Does not contain")
.StartsWith("Starts with")
.IsEqualTo("Is equal to")
.IsNotEqualTo("Is not equal to")
.EndsWith("Ends with "))));
columns.Bound(c => c.AccountType.AccountTypeName).Filterable(flt => flt.UI("accountTypeFilter"));
.Filterable(ftb => ftb.Extra(false))
})
)
@section scripts{
}
1 comment:
Note:
when enable the sorting, the following code will not work:
columns.Bound(c => c.AccountType.AccountTypeName).Filterable(flt => flt.Cell(cell => cell.Template("accountTypeFilterTemplate")));
Instead, we need to use the following code:
columns.Bound(c => c.AccountTypeName).Filterable(flt => flt.Cell(cell => cell.Template("accountTypeFilterTemplate")));
Post a Comment