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

group count in header client-side

1 Answer 54 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Christian
Top achievements
Rank 1
Christian asked on 25 Mar 2011, 07:14 AM

Ajax 2010.3.1317.45

as mentioned in this article,
http://www.telerik.com/help/aspnet-ajax/grdperformcalculationsingroupheader.html

I would like to have calculation (only group "count") on Any column being grouped. is there any way to accomplish this client-side, the reason for asking is that i use

 

 

 

GroupLoadMode="Client"

 


and dont want to set up groupfields for all columns, can i achieve this type of count aggrigation independent from what column is being grouped, maybe trough javascript?

1 Answer, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 31 Mar 2011, 09:45 AM
Hello Christian,

The referred article suggests customization of the GridGroupHeaderItem showing various information about the grouped item. Unfortunately there is no straightforward client-side API that gets access to this elements so one option is to access them through jQuery like that. Note that you also need to manually calculate the proper aggregate value (count, sum) on the client.

function pageLoad()
                {
                    var grid = $find('<%= RadGrid1.ClientID %>');
                    var groupHeaders = $telerik.$(grid.get_masterTableView().get_element()).find('tr[class="rgGroupHeader"]');
                    if (groupHeaders.length > 0)
                    {
                        for (var i = 0; i < groupHeaders.length; i++)
                        {
                            var groupHeadertext = $telerik.$(groupHeaders[0]).find('p')[0].innerHTML;
                            //modify text in some way
                        }
                         
                    }
                     
                }


Best wishes,
Marin
the Telerik team
Tags
Grid
Asked by
Christian
Top achievements
Rank 1
Answers by
Marin
Telerik team
Share this question
or