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

Kendo Grid Multilevel grouping with different aggregates

1 Answer 68 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 29 May 2019, 03:53 PM

Hi, 

I've got a Datagrid grouped by two different groups.The footer templates seems to be working just for the first group. Is it possible to define the footerTemplate for more than one group.

 

This is the datasource:

 

dataSource: {
                    group:[
                        {field: "style", dir: "desc",
                            aggregates: [
                                    { field: "style", aggregate: "count" },
                                    { field: "fob", aggregate: "sum" },
                                    { field: "quantity", aggregate: "sum" },
                                    { field: "approvedQuantity", aggregate: "sum" },
                                    { field: "sellingTotal", aggregate: "sum" },
                                    { field: "fobTotal", aggregate: "sum" },
                            ],
                        },
                        {
                            field: "colour", dir: "desc",
                            aggregates: [
                                    { field: "style", aggregate: "count" },
                                    { field: "fob", aggregate: "sum" },
                                    { field: "quantity", aggregate: "sum" },
                                    { field: "approvedQuantity", aggregate: "sum" },
                                    { field: "sellingTotal", aggregate: "sum" },
                                    { field: "fobTotal", aggregate: "sum" },
                            ],
                        }
                    ],

 

And this is the column:

 

{
                            field: "colour",
                            title: "Colour",
                            footerTemplate: function (data) {
                               
                                return "<div style='text-align:right'>Total Buy Margin: 100%</div>"
                            },
                            groupFooterTemplate: function (data) {
                               
                                var groupBuyMargin = 98; // This is just an example

                                return "<div style='text-align:right'>Style Buy Margin: " + groupBuyMargin + "%</div>"
                            },
                        }

 

Thanks,

Paul

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 31 May 2019, 10:32 AM
Hello Paul,

The footerTemplate is not linked with the grouping and it is rendered for the entire Grid only once. In other hand, the groupFooterTemplate is rendered for each group. Detailed information and examples for the "footerTemplate" and the "groupFooterTemplate" could be found in the following help topics:
Note that each column could have only one footerTemplate and one groupFooterTemplate and they are used in each group level. 

Regards,
Konstantin Dikov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
General Discussions
Asked by
Paul
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or