Server Side Grid Grouping not working properly

3 posts, 0 answers
  1. Asad
    Asad avatar
    15 posts
    Member since:
    Nov 2019

    Posted 20 Nov 2020 Link to this post

    Hello, I am using kendo grid in .NET core, 

    We have load dynamically data in grid using Data table I have bind data and also functional server side pagination. I have facing the issue in grouping on dynamically. Can you please help how can I resolved this issue. or share any document?

    I have also attached my code screenshots. Please review and let me know asap.

  2. Asad
    Asad avatar
    15 posts
    Member since:
    Nov 2019

    Posted 24 Nov 2020 Link to this post

    Edit to the Question: 

    Please see above screenshots attached.
    My objective is to use server side pagination and grouping (groupable == false) , groupable column is being retrieved from DB.
    I've achieved server side pagination and its working properly but when I try to implement grouping things get start twisting.
    Firstly there was pagination error coming i.e first page renders with correct data and total count but from second and onwards data is not showing because it does not convert into DataSourceResult object.

     public IActionResult GetProcessResults([DataSourceRequest] DataSourceRequest request)

    {

        var data = test.ToDataSourceResult(request);// test is datatabe having dynamic columns
                var result = new DataSourceResult()
                {
                    AggregateResults = data.AggregateResults,
                    Data = dt.AsEnumerable(),
                    Total = dt.Rows.Count,

                };
    }

  3. Georgi Denchev
    Admin
    Georgi Denchev avatar
    86 posts

    Posted 25 Nov 2020 Link to this post

    Hello Asad,

    Thank you for the provided screenshots.

    Kendo offers a .ToDataSourceResult() extension that accepts IQueryable as an argument.

    public ActionResult Read([DataSourceRequest] DataSourceRequest request)
    {
        DataTable dt = new DataTable();
    
        return Json(dt.ToDataSourceResult(request));
    }
    

    Essentially what this would do is get the configurations applied to the DataSource such as PageSize, Groups, Filters and so on, and apply them to the DataTable View. It works in a similar way as to when you are using an IEnumerable for the data.

    Let me know in case further assistance is required.

    Best Regards,
    Georgi Denchev
    Progress Telerik

    Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Back to Top