$("#businessunitcommitmentreportgrid").ejGrid({
dataSource: data.commitment_detail,
allowPaging: true,
allowSorting: true,
allowReordering: true,
allowResizing: true,
allowFiltering: true,
allowGrouping: true,
enableHeaderHover: true,
showSummary: true,
summaryRows: [{
title: "Totals",
summaryColumns: [{
summaryType: ej.Grid.SummaryType.Sum,
displayColumn: "usable",
format: "{0:n2}",
dataMember: "usable"
}, {
summaryType: ej.Grid.SummaryType.Sum,
displayColumn: "used",
format: "{0:n2}",
dataMember: "used"
}, {
summaryType: ej.Grid.SummaryType.Sum,
displayColumn: "provisioned_free",
format: "{0:n2}",
dataMember: "provisioned_free"
}, {
summaryType: ej.Grid.SummaryType.Sum,
format: "{0:n2}",
displayColumn: "unprovisioned",
dataMember: "unprovisioned"
}, {
summaryType: ej.Grid.SummaryType.Sum,
format: "{0:n2}",
displayColumn: "over_provisioned",
dataMember: "over_provisioned"
}, {
summaryType: ej.Grid.SummaryType.Sum,
format: "{0:n2}",
displayColumn: "allocated",
dataMember: "allocated"
}, {
summaryType: ej.Grid.SummaryType.Sum,
format: "{0:n2}",
displayColumn: "snap",
dataMember: "snap"
}, {
summaryType: ej.Grid.SummaryType.Custom,
format: "{0:n2}",
displayColumn: "pct_used",
dataMember: "pct_used",
customSummaryValue: function(){
var gridObj = $("#businessunitcommitmentreportgrid").ejGrid("instance");
return ej.sum(gridObj.model.dataSource, "usable"); //This just gives you the whole total, not the group total.
}
}
],showTotalSummary: false
}],
groupSettings: {groupedColumns: ["data_center"]},
filterSettings: {filterType: "Excel"},
columns: [
{field: "data_center", headerText: "Data Center", width: 200},
{field: "array_name", headerText: "Array Name", width: 130},
{field: "category", headerText: "Category", width: 100},
{field: "application", headerText: "Application"},
{field: "usable", headerText: "Usable", format: "{0:n2}", textAlign: ej.TextAlign.Right},
{field: "used", headerText: "Used", format: "{0:n2}", textAlign: ej.TextAlign.Right},
{
field: "provisioned_free",
headerText: "Prov Free",
format: "{0:n2}",
textAlign: ej.TextAlign.Right
},
{
field: "unprovisioned",
headerText: "UnProvisioned",
format: "{0:n2}",
textAlign: ej.TextAlign.Right
},
{
field: "over_provisioned",
headerText: "Over Prov (GB)",
format: "{0:n2}",
textAlign: ej.TextAlign.Right
},
{field: "allocated", headerText: "Allocated", format: "{0:n2}", textAlign: ej.TextAlign.Right},
{field: "snap", headerText: "Snap (GB)", format: "{0:n2}", textAlign: ej.TextAlign.Right},
{field: "pct_used", headerText: "% Used", format: "{0:n2}", textAlign: ej.TextAlign.Right},
{
field: "pct_provisioned_free",
headerText: "% Prov Free",
format: "{0:n2}",
textAlign: ej.TextAlign.Right
},
{
field: "pct_unprovisioned",
headerText: "% UnProv",
format: "{0:n2}",
textAlign: ej.TextAlign.Right
},
{
field: "pct_over_provisioned",
headerText: "% OverProv",
format: "{0:n2}",
textAlign: ej.TextAlign.Right
}
], recordDoubleClick: function (args) {
deviceDrillDown(args.data.upload_id);
}
});
function CustomSummary() {
var gridObj = $("#Grid").ejGrid("instance"), groupedDataSource = gridObj.model.currentViewData;
//Here we can get the grouped data source
return ej.sum(groupedDataSource[0].items, "usable"); //This just gives you the group total.
}
|