We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Essential JS2

Syncfusion jQuery based widgets are no longer in active development. Switch to our pure JavaScript based next generation Essential JS 2 library.

Syncfusion Feedback

How to collapse all the group caption rows in initial rendering of Grid?

Platform: jQuery |
Control: ejGrid
Tags: grouping

This explains that collapsing all Group Caption Rows at initial Rendering of ejGrid.


We can collapse all the Group Caption Rows at initial rendering using dataBound event and collapseAll method of ejGrid. The dataBound event will be triggered when the grid is bound with data at initial rendering. In this event we have to use collapseAll method to collapse all the group caption rows.

To collapse all the Group Caption Rows during paging we have to use actionComplete event and collapseAll method of ejGrid. The actionComplete event will be triggered for every grid action success event. In this event we need to check the requestType as paging and call the collapseAll method.

The following code example demonstrates how to collapse all Group Caption rows at initial rendering and paging:


1. Render the Grid Control.

<div id="Grid"></div>
    <script type="text/javascript">
            // the datasource "window.gridData" is referred from jsondata.min.js
            dataSource: window.gridData,
            allowPaging: true,
            allowGrouping: true,
            actionComplete: "Complete",
            groupSettings: { groupedColumns: ["CustomerID"] },
            dataBound: "dataBound",
            columns: [
                    { field: "OrderID", headerText: "Order ID" },
                    { field: "EmployeeID", headerText: "Employee ID" },
                    { field: "CustomerID", headerText: "Customer ID" },



        .GroupSettings(group => { group.GroupedColumns(col => { col.Add("CustomerID"); }); })
        .Columns(col =>
            col.Field("OrderID").HeaderText("Order ID").Add();
            col.Field("EmployeeID").HeaderText("Employee ID").Add();
            col.Field("CustomerID").HeaderText("Customer ID").Add();
        .ClientSideEvents(eve => eve.ActionComplete("Complete").DataBound("dataBound"))



<ej:Grid ID="OrdersGrid" runat="server" AllowGrouping="True" AllowPaging="True">
   <GroupSettings GroupedColumns="CustomerID"></GroupSettings>
     <ClientSideEvents ActionComplete="Complete" DataBound="dataBound" />
           <ej:Column Field="OrderID" HeaderText="Order ID" />
           <ej:Column Field="EmployeeID" HeaderText="Employee ID" />
           <ej:Column Field="CustomerID" HeaderText="Customer ID" />



<ej-grid id="FlatGrid" allow-paging="true" allow-grouping="true" action-complete="Complete" databound="dataBound" datasource="ViewBag.dataSource">
    <e-group-settings grouped-columns=new List<string>() {"CustomerID"}></e-group-settings>
        <e-column field="OrderID" header-text="Order ID"></e-column>
        <e-column field="EmployeeID" header-text="Employee ID"></e-column>
        <e-column field="CustomerID" header-text="Customer ID"></e-column>



<ej-grid #grid id="Grid" [dataSource]="gridData" [allowPaging]="true" [allowGrouping]="true" [groupSettings]="groupsettings" (actionComplete)="Complete($event)">
        <e-column field="OrderID" headertext="Order ID"></e-column>
        <e-column field="EmployeeID" headertext="Employee ID"></e-column>
        <e-column field="CustomerID" headertext="Customer ID"></e-column>


TS File:

For angular platform use ngAfterViewInit event instead of dataBound event

@ViewChild('grid') GridModel: EJComponents<any, any>;
    export class GridDetailTempComponent {
      public gridData: any;
      groupsettings: any;
      constructor() {
        //The datasource "window.gridData" is referred from 'http://js.syncfusion.com/demos/web/scripts/jsondata.min.js
        this.gridData = (window as any).gridData;
        this.groupsettings = { groupedColumns: ["CustomerID"] } ;
        if(e.requestType == "paging") {
       var grid = this.GridModel.widget;



2. In actionComplete and dataBound event we used the collapseAll method of ejGrid to collapse all Grid Rows.

function Complete(args) {
    if (args.requestType == "paging") {
function dataBound(args) {




Collapsed Grid

You must log in to leave a comment
Apr 27, 2020

this.collapseAll() is undefined

Padmavathy Kamalanathan [Syncfusion]
Apr 29, 2020

Hi Elisabeth,

Thanks for contacting Syncfusion Support.

QUERY: this.collapseAll() is undefined

We are unable to reproduce the reported issue at our end. Collapsing the group caption rows in initial rendering of grid works fine. We have also prepared and shared you sample for your reference.

Please check the below sample,


Please share us the below details so that we could proceed further,

  1. Complete grid rendering code
  2. Please confirm whether you are using Essential Studio Version or share us your version details
  3. Share us the screenshot of error with stack trace (if any)
  4. Video showing the issue


Padmavathy Kamalanathan

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile