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

Server Side Grid Grouping not working properly

2 Answers 535 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Asad
Top achievements
Rank 1
Veteran
Asad asked on 20 Nov 2020, 02:48 PM

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 Answers, 1 is accepted

Sort by
0
Asad
Top achievements
Rank 1
Veteran
answered on 24 Nov 2020, 08:26 AM

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,

            };
}

0
Georgi Denchev
Telerik team
answered on 25 Nov 2020, 02:03 PM

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/.

Tags
Grid
Asked by
Asad
Top achievements
Rank 1
Veteran
Answers by
Asad
Top achievements
Rank 1
Veteran
Georgi Denchev
Telerik team
Share this question
or