Hi,
I have a Kendo Grid with 20columns in that i have 12 columns as months. in one column am getting data like below attached image format (1/0,2/1,3/2). in ClientFooterTemplate am displaying sum of this column. here i want to apply same logic all 12 months.
below is my code.
columns.Group(group => group.Title("200<hr> Jan").Columns(Jan =>
{
Jan.Bound(p => p.Jan_A).Width(60).Filterable(false).Editable("function(dataItem) {if (((new Date).getMonth() + 1) <= 1) {return true}else return false;}").ClientFooterTemplate("#=kendo.toString(conditionalSum(), '0,0')#").HtmlAttributes(new { style = "text-align: center;" }).HeaderHtmlAttributes(new { @class = "col-sm-1 col-md-1 col-lg-1 col-xl-1 ", style = "white-space: normal;text-align: center;" }).Title("A / F");
}));
below is Javascript code
function conditionalSum() {//alert("a")
var dataSource = $("#Grid").data("kendoGrid").dataSource;
var filters = dataSource.filter();
var allData = dataSource.data();
var query = new kendo.data.Query(allData);
var data = query.filter(filters).data;
//var data = dataSource.data();
var item, Jansum = 0,Febsum=0;
for (var idx = 0; idx < data.length; idx++) {
item = data[idx];
if (item.Jan_A != null) {
if (item.Jan_A.includes("/") && item.Jan_A.split("/")[0] != "") {
Jansum += parseInt(item.Jan_A.split("/")[0]);
}
}
if (item.Feb_A != null) {
if (item.Feb_A.includes("/") && item.Feb_A.split("/")[0] != "") {
Febsum += parseInt(item.Feb_A.split("/")[0]);
}
}
}
return kendo.toString(Jansum, "0,0");
}
this function is working fine for only month. how can i use same function for remaining 11 columns.