I have a Grid which has an OnRecordClick event handler setup and this works well for normal non-template columns but does not trigger for template columns.
I have tried adding an OnClick handler to a <div> within the <Template> and this does trigger but the problem is that the handler only gets triggered when you click on the items in the cell and not in the blank area which surrounds them which is different behaviour to how OnRecordClick works.
Is there a way to enable the OnRecordClick to work for Template columns?
Thanks.
<SfGrid DataSource="@_VM" Height="675" Width="100%" RowHeight="45" EnableVirtualization="true" AllowSelection="true"
EnableHover="false" AllowFiltering="true" AllowSorting="true">
<GridSelectionSettings Type="SelectionType.Multiple" CheckboxOnly="true" PersistSelection="true"></GridSelectionSettings>
<GridFilterSettings Type ="Syncfusion.Blazor.Grids.FilterType.CheckBox">
<GridFilterColumns>
<GridFilterColumn Field="StatusName" MatchCase=false Operator="Syncfusion.Blazor.Operator.Equal" Predicate = "or" Value = "@("Active")" ></GridFilterColumn>
<GridFilterColumn Field="StatusName" MatchCase=false Operator="Syncfusion.Blazor.Operator.Equal" Predicate = "or" Value = "@("Draft")" ></GridFilterColumn>
</GridFilterColumns>
</GridFilterSettings>
<GridPageSettings PageSize="80"></GridPageSettings>
<GridEvents OnRecordClick="RecordClickHandler" TValue="ScenarioVM"></GridEvents>
<GridColumns>
<GridColumn Field=@nameof(ScenarioVM.Description) HeaderText="Description" FilterSettings="@(new FilterSettings{Type = Syncfusion.Blazor.Grids.FilterType.Menu})" ClipMode="ClipMode.EllipsisWithTooltip">
<Template>
@{
var scenario = (context as ScenarioVM);
<div @onclick="@(e=>ViewScenario(@scenario.ScenarioId))">
<span>@scenario.Description
@if(scenario.Status==(int)ScenarioStatus.StatusId.Draft) {
<span class="badge badge-pill badge-info">@scenario.StatusName</span>
}
else @if(scenario.Status==(int)ScenarioStatus.StatusId.Deprecated) {
<span class="badge badge-pill badge-danger">@scenario.StatusName</span>
}
</span>
</div>
}
</Template>
</GridColumn>