With the following sample grid, how can I access the foreign key value in the caption template?
@(Html.EJS().Grid<ServiceTaskVm>("ServiceTaskGrid")
.EditSettings(edit => { edit.AllowAdding(true).AllowDeleting(true).AllowEditing(true).ShowDeleteConfirmDialog(true); })
.Toolbar(toolbarItems)
.SortSettings(sort => sort.Columns(new { field = "SortOrder", direction = "Ascending" }))
.Columns(col => {
col.Field(p => p.Id).IsPrimaryKey(true).IsIdentity(true).Visible(false).Add();
col.Field(p => p.ServiceId).Visible(false).Add();
col.Field(p => p.SortOrder).Visible(false).Add();
col.Field("WorkFlowTypeId").HeaderText("WorkFlow").Width(120)
.ForeignKeyField("Id").ForeignKeyValue("Name").DataSource((IEnumerable<object>)ViewBag.dsWorkFlow).Add();
col.Field(p => p.ServiceDateDaysOffset).HeaderText("Service Offset").DefaultValue("0").Width(120).EditType("numericedit").Edit(new { @params = new { format = "n0" } }).Add();
col.Field(p => p.Description).HeaderText("Description").ClipMode(Syncfusion.EJ2.Grids.ClipMode.EllipsisWithTooltip).Add();
})
.AllowGrouping().GroupSettings(group => group.Columns(new string[] { "WorkFlowTypeId" }).CaptionTemplate("#captionTemplate").ShowDropArea(false))
.Render()
)
<script id="captionTemplate" type="text/x-template">
${field} ${key} : ${count} ${if(count===1)} item ${else}items ${/if}
<button id="sortTasks" class="e-icons e-list-numbered-01" type="button"></button>
</script>
I see that ${field} accesses the field name and ${key} accesses the key value, but cannot seem to find a way to get the foreign key value. If I don't assign a CaptionTemplate, then the correct value displays. However I want to add a button to the group header, so need to use the template.
Thank you,
Richard Werning