4 Answers, 1 is accepted
0

Dom
Top achievements
Rank 1
answered on 05 Sep 2012, 06:40 PM
Is it possible to get a value of the group on so that I can pass it to a function and use it in the template? Like this:
columns: [ //some other column definitions go here { field: "ValueAmount", title: "Modifier Value", format: "{0:N2}", groupFooterTemplate: "#= ValueAmountBalance(/* groupId */) #" }, { field: "OverrideAmount", title: "Override", format: "{0:N2}", groupFooterTemplate: "#= OverrideAmountBalance(/* groupId */) #" } ],
0
Hi Dom,
I have already replied to your question in the support ticket that you submitted on the same subject. For convenience I will paste my reply here, so the other users who follow this thread could read it.
I am afraid that the dataSource does not support custom aggregate functions. By default the groupFooterTemplate contains information about current group aggregates, but not the "group by" field and value. As a workaround I can suggest to retrieve this information through thegroupHeaderTemplate (groupHeaderTemplate is executed before groupFooterTemplate). As an example:
Alternatively you may consider using the dataSource.view() which contains information about the group field, value and items. The order of view objects matches the order of displayed items(groups) in the grid.
To avoid any further duplication I would like to ask you to continue our conversation in the support ticket.
Thank you in advance.
Kind regards,
Alexander Valchev
the Telerik team
I have already replied to your question in the support ticket that you submitted on the same subject. For convenience I will paste my reply here, so the other users who follow this thread could read it.
I am afraid that the dataSource does not support custom aggregate functions. By default the groupFooterTemplate contains information about current group aggregates, but not the "group by" field and value. As a workaround I can suggest to retrieve this information through thegroupHeaderTemplate (groupHeaderTemplate is executed before groupFooterTemplate). As an example:
{ field:
"category"
, groupHeaderTemplate:
"# getGroupInfo(data) #"
},
{ field:
"amount"
, groupFooterTemplate:
"#= calculateAggregate(groupByField, groupByValue) #"
}
function
getGroupInfo(data) {
groupByField = data.field;
groupByValue = data.value;
};
//where groupByField and groupByValue are global variables
function
calculateAggregate(field, value) {
return
field +
" "
+ value;
}
Alternatively you may consider using the dataSource.view() which contains information about the group field, value and items. The order of view objects matches the order of displayed items(groups) in the grid.
To avoid any further duplication I would like to ask you to continue our conversation in the support ticket.
Thank you in advance.
Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

Geoff
Top achievements
Rank 1
answered on 16 Dec 2014, 06:54 PM
Is this still the most up to date answer?
0
Hello Geoff,
The previous answer is still valid.
Regards,
Alexander Valchev
Telerik
The previous answer is still valid.
Regards,
Alexander Valchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!