Hello All, I followed this example https://demos.telerik.com/aspnet-mvc/grid/server-grouppaging-virtualization to implement in my project, however i am getting error while doing grouping with mutiple columns, i tried searching in the forms for a solution but no luck.
This is my Code below
Html.Kendo().Grid<Project.ViewModels.ListViewModel>() .Name("GridName") .Columns(columns => { columns.Select().Width(50).HtmlAttributes(new { @class = "checkbox-align" }).HeaderHtmlAttributes(new { @class = "checkbox-align" }); columns.Bound(p => p.Company); columns.Bound(p => p.Country); columns.Bound(p => p.City); columns.Bound(p => p.CodeSociete); }) .ToolBar(toolbar => { toolbar.Create(); }) .ColumnMenu(col => col.Filterable(true)) .Height(550) .Sortable(sortable=>sortable.Enabled(true)) .Navigatable() .Resizable(r => r.Columns(true)) .Groupable() .Filterable(filterable => filterable .Enabled(true) .Extra(true) .Operators(operators => operators .ForString(str => str.Clear() .StartsWith("Starts with") .IsEqualTo("Is equal to") .IsNotEqualTo("Is not equal to") )) ) .Scrollable(scrollable => scrollable.Virtual(true)) .Events(events => events.DataBound("onDataBound")) .DataSource(dataSource => dataSource .Ajax() .Events(events => events.Error("error_handler") ) .Model(model => { model.Id(p => p.ID); }) .GroupPaging(true) .PageSize(50) .Read("DetailProducts_Read", "List") ))
My Controller class ListController.cs
[HttpPost] public ActionResult DetailProducts_Read([DataSourceRequest]DataSourceRequest request) { IEnumerable<List_Entity> list = myService.getAll(out totalRecords, this.UserId.ToString()); listDB = list .Select(f => new ListViewModel() { ID = f.ID, Company= f.Company, Country= f.Country, City= f.City, CodeSociete= f.CodeSociete
, }).ToList(); DataSourceResult result = listDB.ToDataSourceResult(request); result.Total = (int)totalRecords; return new JsonResult() { Data = result, JsonRequestBehavior = JsonRequestBehavior.AllowGet, MaxJsonLength = Int32.MaxValue }; }
When i run the application virtualisation,sorting,filtering,paging works perfectly without grouping, when i try to group with first colum drag and drop all the events work perfectly, but when i try to drag second column to grouping i get the following error (errorDebug.png) and in the browser console window i have this error
Uncaught TypeError: Cannot read property 'length' of undefined
at Function.map (jquery-1.10.2.js:789)
at init.groups (kendo.aspnetmvc.js:212)
at proxy (jquery-1.10.2.js:841)
at init.groups (kendo.all.js:6508)
at init._readData (kendo.all.js:7371)
at init.success (kendo.all.js:7575)
at success (kendo.all.js:7527)
at Object.n.success (kendo.all.js:6404)
at fire (jquery-1.10.2.js:3062)
at Object.fireWith [as resolveWith] (jquery-1.10.2.js:3174)
Could you please help me to resolve this issue?