if (e.TableCellIdentity.TableCellType == GridTableCellType.SummaryFieldCell)
{
// This line will display/extract the value from the matched cell
MessageBox.Show(e.Style.CellValue.ToString());
// This line will allow the setting of new value for the matched cell
e.Style.CellValue = "200";
}
is it possible to do the same thing with ejgrid for javascript/angularjs
<div id="Grid" ej-grid e-datasource="data" e-allowpaging="true" e-showsummary="true" e-summaryrows="summary">
<div e-columns>
----------
<div e-column e-field="Freight" e-headertext="Freight" e-textalign="left" e-format="{0:c2}" e-width="90"></div>
----------
</div>
<script>
angular.module('listCtrl', ['ejangular'])
.controller('PhoneListCtrl', function ($scope) {
$scope.data = window.gridData;
$scope.summary = [{
title: "Currency",
summaryColumns: [{
summaryType: ej.Grid.SummaryType.Custom,
customSummaryValue: currency,
displayColumn: "Freight",
format: "{0:c2}"
}]
}]
});
function currency() {
//to get grid instance
var gridObj = $("#Grid").ejGrid("instance");
//ej.sum is aggreagte to add datas of freight from datasource
return ej.sum(gridObj.model.dataSource(), "Freight");
}
</script>
|
name | date | hours | quantity | total |
id: 1 - 3 items | ||||
John | 01/09/2018 | 8 | 30 | 240 |
John | 02/09/2018 | 8 | 30 | 240 |
John | 03/09/2018 | 8 | 30 | 240 |
Sum | 720 | |||
id: 2 - 3 items | ||||
Mark | 01/09/2018 | 7 | 30 | 210 |
Mark | 02/09/2018 | 7 | 30 | 210 |
Mark | 03/09/2018 | 8 | 30 | 240 |
Sum | 660 | |||
Sum | 1380 |
name | date | hours | quantity | total |
id: 1 - 3 items | ||||
John | 01/09/2018 | 8 | 30 | 240 |
John | 02/09/2018 | 8 | 30 | 240 |
John | 03/09/2018 | 8 | 30 | 240 |
Sum of 1 | 720 | |||
id: 2 - 3 items | ||||
Mark | 01/09/2018 | 7 | 30 | 210 |
Mark | 02/09/2018 | 7 | 30 | 210 |
Mark | 03/09/2018 | 8 | 30 | 240 |
Sum of 2 | 660 | |||
Sum | 1380 |