I'm encountering a problem with my Kendo grid that is populated with AJAX in an ASP.NET MVC view. When I attempt to group by the property FacturasCabecera.NFactura, I get a JavaScript error stating
d.ArtFacturasCabecera is undefined
, causing the Kendo grid to hang. One of the elements in the model of the grid is FacturasCabecera, a separate model object that contains the property I'm trying to group by. Below is the code for the grid, which is in a Razor view:
@(Html.Kendo().Grid<Macromed.Models.ArtFacturasDetalleModels>()
.Name("GridAuditoria")
.Columns(
columns =>
{
// Column bindings omitted for brevity
})
.Groupable(group => group.Enabled(true).Messages(mm => mm.Empty("Drag a Column Header Here to Group")))
.DataSource(
datasource => datasource.Ajax()
.PageSize(10)
.Read(read => read.Action("GetFacturaAjustar", "AuditoriaTraslados", new { id = ViewBag.id, fechadesde = ViewBag.fechadesde, fechahasta = ViewBag.fechahasta }))
.Model(model =>
{
// Model bindings omitted for brevity
}))
)
And here is the code fetching data from the database:
IQueryable<ArtFacturasDetalleModels> objfactura = from facturadet in db.ArtFacturasDetalle
// Data fetching criteria omitted for brevity
select new ArtFacturasDetalleModels
{
// Model mappings omitted for brevity
};
DataSourceResult result1 = objfactura.ToDataSourceResult(request1);
return Json(result1);
It seems like the Kendo grid is having trouble handling this type of model structure...