This is a migrated thread and some comments may be shown as answers.

Grid data is undefined after upgrade to Core 3.2

1 Answer 216 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brad
Top achievements
Rank 1
Brad asked on 06 Jan 2020, 12:23 PM

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>&nbsp;|&nbsp;
        <a rel='nofollow' href="/Routes/Details/${RouteId}">Details</a>&nbsp;|&nbsp;
        <a rel='nofollow' href="/Routes/Delete/${RouteId}">Delete</a>&nbsp;
    </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() });
        }

1 Answer, 1 is accepted

Sort by
0
Alex Hajigeorgieva
Telerik team
answered on 09 Jan 2020, 08:47 AM

Hi, Brad,

Thank you for providing the grid definition which appears to be not a Kendo UI Grid but a SyncFusion one.

Therefore, it is best to check with SyncFusion what could be the reason for the grids not working.

Kind Regards,
Alex Hajigeorgieva
Progress Telerik

Get quickly onboarded and successful with Telerik UI for ASP.NET Core with the dedicated Virtual Classroom technical training, available to all active customers.
Tags
Grid
Asked by
Brad
Top achievements
Rank 1
Answers by
Alex Hajigeorgieva
Telerik team
Share this question
or