How to show grouped rows based on the pageSize

17 Feb 20221 minute to read

By default, we have displayed the no of records based on the pageSize. If you want to show grouped column rows based on the pageSize then we suggest you to use the below way.

In the below sample, we have overridden the default generateQuery to display the grouped rows instead of grid rows based on the pageSize.

    var old = ej.grids.Data.prototype.generateQuery;
    ej.grids.Data.prototype.generateQuery = function () {
        var query =, true);
        return query;

<ejs-grid id="Grid" dataSource="@ViewBag.DataSource" allowGrouping="true" allowPaging="true">
    <e-grid-groupSettings showDropArea="true" columns="@(new string[] { "ShipCountry"})"></e-grid-groupSettings>
    <e-grid-pagesettings pageSize=5></e-grid-pagesettings>
        <e-grid-column field="OrderID" headerText="Order ID" textAlign="Right" width="100"></e-grid-column>
        <e-grid-column field="CustomerID" headerText="Customer ID" type="string" width="120"></e-grid-column>
        <e-grid-column field="Freight" headerText="Freight" textAlign="Right" format="C2" width="120"></e-grid-column>
        <e-grid-column field="ShipCountry" headerText="Ship Country" width="150"></e-grid-column>
public IActionResult Index()
    var Order = OrderDetails.GetAllRecords();
    ViewBag.DataSource = Order;
    return View();