Here is my code:
@(Html.Kendo().Grid<TelerikMvcApp1.Models.UserViewModel>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.FirstName)
.Filterable(f => f
.Operators(operators => operators
.ForString(str => str.Clear()
.StartsWith("Starts With")
.EndsWith("Ends With")
.IsEqualTo("Is Equal To")
.IsNotEqualTo("Is Not Equal To")
)
)
)
.Title("First Name")
.Width(200);
columns.Bound(p => p.LastName)
.Filterable(f => f
.Operators(operators => operators
.ForString(str => str.Clear()
.StartsWith("Starts With")
.EndsWith("Ends With")
.IsEqualTo("Is Equal To")
.IsNotEqualTo("Is Not Equal To")
)
)
)
.Title("Last Name")
.Width(200);
columns.Bound(p => p.Email)
.Filterable(f => f
.Operators(operators => operators
.ForString(str => str.Clear()
.StartsWith("Starts With")
.EndsWith("Ends With")
.IsEqualTo("Is Equal To")
.IsNotEqualTo("Is Not Equal To")
)
)
)
.Title("Email ID")
.Width(200);
columns.Bound(p => p.Status)
.Title("Status")
.Filterable(ftb => ftb
.Cell(c => c
.ShowOperators(false)
)
)
.Width(200);
columns.Bound(p => p.LastAccess)
.Filterable(true)
.Title("Last Access")
.Format("{0:MM/dd/yyyy}")
.Width(200);
})
.AutoBind(true)
.Pageable(pageable => pageable
.PageSizes(true)
)
.Selectable(selectable => selectable
.Mode(GridSelectionMode.Multiple)
.Type(GridSelectionType.Row)
)
.Sortable(sortable => sortable
.AllowUnsort(true)
.SortMode(GridSortMode.SingleColumn))
.Scrollable(a => a.Height(100))
.Filterable(f => f
.Mode(GridFilterMode.Row)
.Extra(false)
)
.Reorderable(reorder => reorder.Columns(true))
.Resizable(resize => resize.Columns(true))
.HtmlAttributes(new { style = "height:720px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(25)
.Read(read => read.Action("Details_Read", "Grid"))
)
)
In the blocked letter lines is the part where i cannot customize the filter. So, please anyone tell me how to create a custom filter when using .Mode(GridFilterMode.Row) and i have tried using template within the cell(in 'status' column) to create a drop down list, but it is also not working. There are no good examples on this custom filter in MVC razor syntax. In this custom filter i want to keep two options, so please anyone tell me how can i do that!