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

Grid Collapsed on DataBound


I have a grid, in which the desire default behavior is that it apears collapsed and not expanded.

I tried to do this

.ClientSideEvents(eve => { eve.DataBound("Collapse"); })

function Collapse(args) { var tbarObj = $(args.target), grid = this; grid.collapseAll(); //collapse Grid using grid instance, `this` is grid instance }

But when I edit a row, or make some actions, the entire grid expands, and the expected result is that the grid keep the state, so, if everything is collapse and just one row is expanded, when I do some action, all the other rows, keep their state.

Thanks in advance

5 Replies

PK Prasanna Kumar Viswanathan Syncfusion Team October 21, 2016 12:41 PM UTC

Hi Dayne, 

Thanks for contacting Syncfusion support. 

Query : “If I then edit a row and press save, all the groups expand.” 
We created a sample according to your code example and we able to face the mentioned behavior. To achieve your requirement, we suggest you to use the beginEdit and endEdit events of ejGrid. In the beginEdit event we get the expanded group columns. 

In the endEdit event we collapse all the rows by using collapseAll() method and expand the particular column by using expandCollapse method. 

Please find the code example and sample: 

    .GroupSettings(group => { group.GroupedColumns(col => { col.Add("Freight"); }); }) 
        .ClientSideEvents(eve => { eve.DataBound("dataBound").BeginEdit("edit").EndEdit("endEdit"); }) 
    .Columns(col => 
    function dataBound(args) { 
        var tbarObj = $(args.target), 
        grid = this; 
        grid.collapseAll(); //collapse Grid using grid instance, `this` is grid instance                 
    function edit(args) { 
        detailRows = this.element.find(".e-recordplusexpand"); 
    function endEdit(args) { 
        var collapse = this.element.find(".e-recordpluscollapse"); 
        for (var i = 0 ; i < detailRows.length ; i++) { 
            for (var j = 0 ; j < collapse.length ; j++) { 
                if ($(collapse[j]).siblings().text() == $(detailRows[i]).siblings().text()) 

Refer to the Help document for the beginEdit and endEdit event.  

Prasanna Kumar N.S.V 

DA Dayne November 2, 2016 06:21 PM UTC

Excellent!! This solution works just fine!! Thanks!!

PK Prasanna Kumar Viswanathan Syncfusion Team November 3, 2016 04:08 AM UTC

Hi Dayne, 

We are happy to hear that the provided solution has been working fine at your end. 

Please let us know if you need any further assistance. 

Prasanna Kumar N.S.V 

LJ Laura Jordan November 14, 2016 03:31 PM UTC


I am using code example for Grid collapse and it works fine most of the time, but sometimes when I expand one group and start to edit some rows, it collapse (the group that I am editing).

Can you please have any solution to avoid that behavior? What I want is that the current editing group doesn't collapse. 

Appreciate the support,


PK Prasanna Kumar Viswanathan Syncfusion Team November 15, 2016 12:40 PM UTC

Hi Dayne, 

We checked in our sample and rows does not get collapse when we edit the rows. For your convenience we attached a video and download the video from the following link 

When grouping is applied, grouped records are organized into a hierarchical structure based on the value of Grouping column. When we change the particular value by editing, the particular row will be moved to another page/group based on the value. So, it seems the rows gets to be collapsed. We suspect that this is the issue that you will be facing in your sample.  
If still you face the same issue, share the following details  
1. Code example of a Grid. 
2. If possible, replicate the issue in the attached sample.  
3. Essential Studio Version. 
Prasanna Kumar N.S.V 

Live Chat Icon For mobile
Up arrow icon