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

Grid groups do not expand or collapse

4 Answers 331 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Stan
Top achievements
Rank 1
Stan asked on 04 Jan 2012, 05:20 PM

Once button on the form is clicked, the grid is groupped with something like:

GridGroupByExpression expression = new GridGroupByExpression();
            expression.SelectFields.Add(new GridGroupByField
            {
                FieldName = "orderNumber",
                HeaderText = "Order",
                FormatString = "<strong>{0}</strong>"
            });
            myGgrid.MasterTableView.GroupByExpressions.Add(expression);
        }

That works fine, but the groups cannot be collapsed or expanded (if I set GroupsDefaultExpanded="false" and they are collapsed by default). When group expand/collapse is clicked, the gird posts back  but that does not change grouping. Where would I look to fix it?

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 05 Jan 2012, 06:25 AM
Hello Stan,

I tried the same scenario which worked as expected in my end. Check the following demo which implements the same.
Grid / Group By Expressions

Thanks,
Princy.
0
Stan
Top achievements
Rank 1
answered on 06 Jan 2012, 02:28 PM
Here is some more details on the problem.

There are some empty details rows. These rows are turned off (visible = fals) on the server. The grid, however sends these rows to the client like this:
<tr style="display: none">
   <td class="rgExpandCol" ....
   <!-- detail record goes here .... -->

and then when a group is collapsed and expanded, sure enough, style="display: none" is gone and the chilldren rows are visible.

I have no idea why grid does that..

-Stan
0
Andrey
Telerik team
answered on 09 Jan 2012, 03:30 PM
Hi Stan,

Could you check what is the content of the added expression by hooking the PreRender event and setting a break point in it? Additionally if you could post some portion of your code, for example the RadGrid declaration and the corresponding Events would be helpful to all people who wish to help you.

Kind regards,
Andrey
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Stan
Top achievements
Rank 1
answered on 10 Jan 2012, 03:33 PM
Andrey,

It probably doesn't worth spending time on this, because our control version is at least one year old. In case anybody else will have this problem, I fixed it with a piece of crude code:

function OnGroupExpanded(sender, e) {
        //debugger;
        var grid = $find(sender.get_id());
        var masterTableView = grid.get_masterTableView();
        var gridTableViews = grid.get_detailTables();
  
        for (var index = 0; index < gridTableViews.length; index++) {
            masterTableView.collapseItem(index);
        }
    }

Tags
Grid
Asked by
Stan
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Stan
Top achievements
Rank 1
Andrey
Telerik team
Share this question
or