|
<ejs-grid id="Grid" dataSource="@ViewBag.Datasource" allowGrouping="true" allowPaging="true">
<e-grid-aggregates>
<e-grid-aggregate>
<e-aggregate-columns>
<e-aggregate-column field="Freight" type="Sum" groupFooterTemplate="Total units: ${Sum}" footerTemplate="Sum:${Sum}"></e-aggregate-column>
<e-aggregate-column field="CustomerID" groupFooterTemplate="custom message" footerTemplate="Truecount:${Truecount}" type="Truecount" ></e-aggregate-column>
</e-aggregate-columns>
</e-grid-aggregate>
</e-grid-aggregates>
<e-grid-groupsettings captionTemplate="#captiontemplate"></e-grid-groupsettings>
. . .
</ejs-grid>
<script id="captiontemplate" type="text/x-template">
${if( field=="CustomerID")} custom messge ${else} ${field} of ${key} contains ${count} item
${/if}
</script>
|
|
<ejs-grid id="Grid" dataSource="@ViewBag.Datasource" allowGrouping="true" allowPaging="true">
<e-grid-aggregates>
<e-grid-aggregate>
<e-aggregate-columns>
<e-aggregate-column field="Freight" type="Sum" groupFooterTemplate="Total units: ${Sum}" footerTemplate="Sum:${Sum}"></e-aggregate-column>
<e-aggregate-column field="CustomerID" groupFooterTemplate="custom message" footerTemplate="Truecount:${Truecount}" type="Truecount" ></e-aggregate-column>
</e-aggregate-columns>
</e-grid-aggregate>
</e-grid-aggregates>
…
</ejs-grid>
|
|
<ej-grid id="FlatGrid" datasource="ViewBag.datasource" show-summary="true" allow-grouping="true" group-settings ="@(new GroupSettings { GroupedColumns= new List<string>() { "EmployeeID"}, CaptionFormat="#template" })" allow-paging="true" action-complete="databound">
<e-summary-rows>
. . .
</e-summary-rows>
<e-columns>
<e-column field="OrderID" is-primary-key="true" header-text="Order ID" text-align="Right" width="90"></e-column>
<e-column field="CustomerID" header-text="CustomerID" width="90"></e-column>
<e-column field="EmployeeID" header-text="Employee ID" text-align="Right" width="80"></e-column>
. . .
</e-columns>
</ej-grid>
<script id="template" type="text/x-jsrender">
{{:headerText}}: {{:count}} Items- {{if count == 1 }} MyValue{{:key}} {{else}} OtherValue{{:key}} {{/if}} //based on Items count we have changed the Caption value
</script> |
|
{{:field}} |
Defines the field name of the current group column(in your case Perfil) |
|
{{:key}} |
Defines the current group value(in your case Profile A) |
|
{{:count}} |
Defines the number of records under the current group |
|
{{:headerText}} |
Defines the headerText value of the current group column(header text of the column with field Perfil) |