Hello Boyan,
When I have tried to replicate your solution at the rest of my grids, I realise that it is not working when the field defined in columns is a field belong to another model in the main model.
In my example :
@(Html.Kendo().Grid<RetractAssessmentViewModel>()
.Name("RetractAssessmentGrid")
.Columns(columns =>
{
columns.Template(@<text></text>).ClientTemplate("<input type='checkbox' class='chkbx' />")
.HeaderTemplate("<input type='checkbox' id='chkSelectAll' onclick='checkAll(this)'/>").Width(30);
columns.Bound(c => c.AssessmentId).Visible(false);
columns.Bound(c => c.User.Id).Visible(false);
columns.Bound(c => c.User.UserNameDescriptive).Width(300).Filterable(ftb => ftb.Multi(true).Search(true)).Title("Participant Names For Selection");
columns.Bound(c => c.Profile.L1Process.L1Id).Visible(false);
columns.Bound(c => c.Profile.L1Process.Name).Width(300).Filterable(ftb => ftb.Multi(true).Search(true)).Title("L1 Processes");
columns.Bound(c => c.Profile.ProcessRole.ProcessRoleId).Visible(false);
columns.Bound(c => c.Profile.ProcessRole.Name).Width(200).Filterable(ftb => ftb.Multi(true).Search(true)).Title("Process Roles");
columns.Bound(c => c.RoleType.RoleTypeId).Visible(false);
columns.Bound(c => c.RoleType.Name).Width(150).Filterable(ftb => ftb.Multi(true).Search(true)).Title("Role Types");
....
.Reorderable(reorderable => reorderable.Columns(true))
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.PageSizes(new int[] { 5, 10, 20, 30 })
.ButtonCount(5))
.Events(events =>
{
events.DataBound("onDataBoundRetractAssessmentGrid");
events.FilterMenuInit("filterMenuInit");
})
)
.....
function filterMenuInit(e) {
if (e.field === "User.UserNameDescriptive" || e.field === "Profile.L1Process.Name" || e.field === "Profile.Name" || e.field === "Profile.ProcessRole.Name") {
var filterMultiCheck = this.thead.find("[data-field=" + e.field + "]").data("kendoFilterMultiCheck")
filterMultiCheck.container.empty();
filterMultiCheck.checkSource.sort({ field: e.field, dir: "asc" });
filterMultiCheck.checkSource.data(filterMultiCheck.checkSource.view().toJSON());
filterMultiCheck.createCheckBoxes();
}
}
If I want to sort the field 'User.UserNameDescriptive' the application send me a warning saying :
Syntax error, unrecognized expression : [data-field=User.NameDescriptive].
I send you an attached screenshot.
Thanks in advanced.