Hi Team,
When I try to use
$(document).ready(function () {
$("#grid2").data("kendoGrid").dataSource.filter({ logic: "and", filters: [{ field: "Title", operator: "contains", value: "nurse" }] })
});
I got an error of "Cannot read property 'dataSource' of undefined at HTMLDocument.eval".
The following is my grid:
@(Html.Kendo().Grid(Model)
.Name("grid2")
.Columns(columns =>
{
columns.Command(command => command.Custom("Add").Click("AddToTeam")).Width(40);
columns.Bound(p => p.StaffItem.FullName).Title("Name").Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")));
columns.Bound(p => p.StaffItem.JobTitleDesc).Title("Title").Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")));
})
.Pageable()
.Sortable()
.Filterable(ftb=>ftb
.Extra(false)
.Operators(operators => operators
.ForString(str => str.Clear()
.Contains("Contains")
.IsEqualTo("Is equal to")
.IsNotEqualTo("Is not equal to")
)))
.DataSource(d => d
.Ajax()
//.Filter(f=>f.Add(a=>a.StaffItem.JobTitleDesc).Contains("nurse"))
.ServerOperation(false)
.PageSize(8)
)
.Resizable(resize => resize.Columns(true))
.Reorderable(reorder => reorder.Columns(true))
)