Collapse Group Items

Hi,

is it possible to render a grouped grid with collapsed group items per default?

Cheers,
Jonas

3 Replies

TS Thavasianand Sankaranarayanan Syncfusion Team February 8, 2018 11:22 AM UTC

Hi Jonas, 

Thanks for contacting Syncfusion support. 

We have analyzed your query and we suspect that you want to collapse the grid at initial rendering. So, we suggest you to use the collapseAll() method in the dataBound event of ejGrid control. 

Refer the below code example. 


@(Html.EJ().Grid<EmployeeView>("MasterGrid") 
        .Datasource((IEnumerable<object>)ViewBag.datasource) 
        .AllowPaging() 
 
        .AllowGrouping()// enable Grouping 
 
        .GroupSettings(gset => gset.GroupedColumns(gcol => { gcol.Add("ShipCity"); })) 
// initially group ShipCity column 
 
        .ClientSideEvents(events => events.DataBound("GridDataBoundEvent")) // bind dataBound event 
 
        .Columns(col => 
        { 
             
            --- 
 
            col.Field("ShipCity").HeaderText("Ship City").Width(110).Priority(2).Add(); 
 
        }) 
         
) 
<script> 
    function GridDataBoundEvent(args) { 
 
        this.collapseAll();// collapse all the grouping use collapseAll() method 
 
    } 
</script> 



Refer the help documentation. 




Regards, 
Thavasianand S. 



JZ Jonas Züger February 8, 2018 08:36 PM UTC

Thanks a lot!

Cheers Jonas


TS Thavasianand Sankaranarayanan Syncfusion Team February 9, 2018 04:33 AM UTC

Hi Jonas, 
 
We are happy that the problem has been solved at your end. 
 
Please get back to us if you need any further assistance.  
 
Regards, 
Thavasianand S. 


Loader.
Up arrow icon