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

[Solved] Bind GroupFooter / Footer to custom data

3 Answers 213 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Simon Störmer
Top achievements
Rank 1
Simon Störmer asked on 31 Aug 2010, 03:39 PM
Hi all,

we use RadGridView and its grouping functionionality in conjunction with the aggregate functions. We have a table with over 1.000.000 records and 240 columns, so we use paging as well, having only 20 rows and just the columns the user needs in the client at once.

When it comes to aggregate functions it turns out that they are calculated on the data the grid holds in its ItemsSource (of course). If I have a group that spans over two pages, the group aggregates are also calculated on the data of the present page.

It is desired that the grid footer shows the aggregates over the whole data and the group footer should show the overall group results. I am able to calculate the desired information on the server and transfer it to the client by means of a data contract object.

My problem is: I dont know how to bind the objects holding the results to the footer of the grid / the group. Is there any way to set the data context of these objects? Is there any way to achive this via the AggregeteResults collection of the grid?

Thanks for any help.

Tobias.

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 02 Sep 2010, 08:35 AM
Hello,

 I've attached small example to illustrate you possible approach how to achieve this. 

Greetings,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Simon Störmer
Top achievements
Rank 1
answered on 13 Sep 2010, 11:21 AM
Hi Vlad,

thanks for your reply. I appologize my late reply but I had some other issues first.

While your answer is quite helpful for me, it does not answer my question as a whole. You have shown a way to bring the same custom data to all group footers by using the group footer template.

What I need is to bring different custom data into each group footer. The scenario is, that we calculate the aggregations according to the defined GroupDefinitions on the server side. We want to bind this individual grouping results to the according group footer. We do this because we want the aggregations to be computed over the whole group, not only the part of the group that is visible on the current page.

I thought about writing dummy aggregate functions where I pass in the actual server result, but I dont know how to tell the grid to use the correct result for a given grouping.

Thanks in advance,

Tobias.
0
Vlad
Telerik team
answered on 13 Sep 2010, 12:45 PM
Hello,

If you want you can load different template dynamically (with different values) using the approach demonstrated on this demo. Here is an example how to access the current group in SelectTemplate method:

 public class MyGroupFooterTemplateSelector : DataTemplateSelector
    {
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            var group = ((GridViewGroupFooterCell)container).ParentOfType<GridViewGroupRow>().Group;

            return base.SelectTemplate(item, container);
        }
    }

Greetings,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Simon Störmer
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Simon Störmer
Top achievements
Rank 1
Share this question
or