|
[Grid]
<ejs-grid id="Grid" dataSource="ViewBag.datasource" allowPaging="true">
. . .
<e-grid-aggregates>
<e-grid-aggregate>
<e-aggregate-columns>
<e-aggregate-column field="Freight" type="Sum" format="C2" footerTemplate="Sum:${Sum}"></e-aggregate-column>
</e-aggregate-columns>
</e-grid-aggregate>
</e-grid-aggregates>
. . .
<e-grid-columns>
. . .
</e-grid-columns>
</ejs-grid>
[Cs code]
public int? OrderID { get; set; }
. . .
public Double? Freight { get; set; }
. . . |
|
...
var ej2_grid = new ej.grids.Grid({
dataSource:[],
allowGrouping: true,
groupSettings: { columns: ["ShipCountry"]},
columns: [. . .
{ field: "ShipCountry", headerText: "Ship Country", type:'string', width: "140" },
{ field: "Freight", headerText: "Freight", type:'number', textAlign: "Right", width: "160", format: "C2", }
],
aggregates: [
{ columns: [{ field: "Freight", format: "C2", groupCaptionTemplate: "${Sum}", type: "Sum" }] }
]
}); |