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.
Syncfusion Feedback

How can I collapse grouped columns based on a row status

Thread ID:





146548 Aug 7,2019 08:12 PM UTC Aug 13,2019 06:14 AM UTC ASP.NET Core - EJ 2 3
Tags: DataGrid
Asked On August 7, 2019 08:12 PM UTC


I want to collapse all the groups that only group one row (and apply another row field condition..) and let the other groups be expanded.

I think the this.groupModule.expandCollapseRows(); on the dataBound event is related, right?


Thavasianand Sankaranarayanan [Syncfusion]
Replied On August 8, 2019 09:42 AM UTC

Hi Pablo, 

Greetings from Syncfusion support. 

Yes, we can achieve this requirement using the gridObj.groupMoudle. expandCollapseRows() method in Grid. 

In the below code example, we have collapse some groups based on group key values (“Berlin, Madrid”) in an external button click event. 

        <ejs-button id="collapseGroup" content="Collapse_Grouped_Rows"></ejs-button> 
        <ejs-grid id="Grid" dataSource="ViewBag.datasource" allowGrouping="true"> 
            <e-grid-groupsettings columns="@(new string[] { "ShipCity" })" showGroupedColumn="true"></e-grid-groupsettings> 
    document.getElementById('collapseGroup').addEventListener('click', function (args) { 
        var obj = document.getElementById('Grid').ej2_instances[0]; 
        var collapsableKeyValue = ["Berlin", "Madrid"]; 
        for (var i = 0; i < collapsableKeyValue.length; i++ ) { 
            var collapseElement = obj.getContentTable().querySelectorAll("td[ej-mappingvalue= '" + collapsableKeyValue[i] + "']")[0]; 

We have prepared a sample and it can be downloadable from the below location. 

Thavasianand S. 

Replied On August 12, 2019 06:14 PM UTC


Balaji Sekar [Syncfusion]
Replied On August 13, 2019 06:14 AM UTC

Hi Pablo, 
Thanks for your update,  
We glad to hear that your problem has been resolved. 
Please get back to us if you need further assistance. 
Balaji Sekar. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

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

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
Live Chat Icon