Hi Customer,
In the template, method can be called using the data as parameter as follows. The parameter will provide details about the current grouping column only which is the required behavior. If you would like to mention any other column, refer to the window.format method as shown in the code example.
@Html.EJS().Grid("Grid").DataSource((IEnumerable<object>)ViewBag.DataSource).
. ..
. . .
AllowGrouping().GroupSettings(group => { group.Columns(new string[] { "Freight" }).CaptionTemplate("#captiontemplate"); }).Render()
<script id="captiontemplate" type="text/x-template">
${format(data)}
</script>
<script>
window.format = function (data) {
var inst = document.getElementById('Grid').ej2_instances[0]
var val = inst.getColumnByIndex(inst.getColumnIndexByField(data.field) + 1).field + ' - ' + data.key;
return val;
}
</script> |
Regards,
Seeni Sakthi Kumar S.