This is a migrated thread and some comments may be shown as answers.

Collapsing/expanding group by clicking on group name

2 Answers 125 Views
Grid
This is a migrated thread and some comments may be shown as answers.
GrZeCh
Top achievements
Rank 2
GrZeCh asked on 23 Mar 2009, 07:37 PM
Hello!

How can I make collapsing / expanding group by clicking on group name (client side)?

For example:
http://demos.telerik.com/aspnet-ajax/grid/examples/groupby/grouploadmodeclient/defaultcs.aspx

When I click on "Country: Argentina" group should collapse.

Thanks

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 24 Mar 2009, 04:20 AM
Hello Grzegorz,

You can check out the following code library submission which explains on how to expand or collapse items under a group in RadGrid on double clicking the GroupHeader. This should probably help you achieve your scenario.
ExpandCollapseGroupedGridOnDoubleClickingTheGroupHeader

Thanks
Princy.
0
GrZeCh
Top achievements
Rank 2
answered on 24 Mar 2009, 12:36 PM
any idea how to do this on client side?

Expand/Collapse image/input is executing:
onclick="$find("ctl00_ContentPlaceHolder1_screencastsRadGrid_ctl00")._toggleGroupsExpand(this, event); return false

I tryed to modify sample provided by you by changing javascript Expand function to:
function Expand(elementHeader) { 
    $(elementHeader).children('td.rgGroupCol:first input').click(); 
and RadGrid OnitemDataBound event to:
protected void screencastsRadGrid_OnItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
            if (e.Item is GridGroupHeaderItem) 
            { 
                GridGroupHeaderItem GroupHeader = (GridGroupHeaderItem)e.Item; 
                GroupHeader.Attributes.Add("onClick""Expand(this);"); 
            } 
but it just freezes browser.
Tags
Grid
Asked by
GrZeCh
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
GrZeCh
Top achievements
Rank 2
Share this question
or