I recently upgraded my project to ASP NET Core 3.2 and now my grids are returning undefined. I've found a couple threads about this, but nothing that has worked for me so far. I have an enumerable defined object that I'm creating in my AJAX LoadData method to load my data and returning. What am I doing wrong?
index.cshtml
<ejs-grid id="Grid" allowPaging="true" allowSorting="true" allowFiltering="true">
<e-data-manager url="/Routes/LoadData" updateUrl="/Routes/UpdateData" adaptor="UrlAdaptor"></e-data-manager>
<e-grid-columns>
<e-grid-column field="Name" headerText="Name" allowSorting="true"></e-grid-column>
<e-grid-column field="Frequency.Name" headerText="Frequency" type="string"></e-grid-column>
<e-grid-column field="DayOfWeek.Name" headerText="Day" type="string"></e-grid-column>
<e-grid-column field="TimeOfDay.TimeString" headerText="Time"></e-grid-column>
<e-grid-column field="RouteId" headerText="" template="#edittemplate"></e-grid-column>
</e-grid-columns>
</ejs-grid>
<script id="edittemplate" type="text/x-template">
<div>
<a rel='nofollow' href="/Routes/Edit/${RouteId}">Edit</a> |
<a rel='nofollow' href="/Routes/Details/${RouteId}">Details</a> |
<a rel='nofollow' href="/Routes/Delete/${RouteId}">Delete</a>
</div>
</script>
Controller
public IActionResult LoadData([FromBody]DataManagerRequest dm)
{
var sa = new JsonSerializerSettings();
IEnumerable<Route> DataSource = _context.Route
.Include(r => r.DayOfWeek)
.Include(r => r.Frequency)
.Include(r => r.TimeOfDay)
.ToList();
DataOperations operation = new DataOperations();
if (dm.Search != null && dm.Search.Count > 0)
{
DataSource = operation.PerformSearching(DataSource, dm.Search); //Search
}
if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting
{
DataSource = operation.PerformSorting(DataSource, dm.Sorted);
}
if (dm.Where != null && dm.Where.Count > 0) //Filtering
{
DataSource = operation.PerformFiltering(DataSource, dm.Where, dm.Where[0].Operator);
}
int count = DataSource.Cast<Route>().Count();
if (dm.Skip != 0)
{
DataSource = operation.PerformSkip(DataSource, dm.Skip); //Paging
}
if (dm.Take != 0)
{
DataSource = operation.PerformTake(DataSource, dm.Take);
}
return Json(new { result = DataSource, count = _context.Route.Count() });
}