@using Syncfusion.Blazor.Grids
<SfGrid DataSource="@Employees">
<GridEvents RowDataBound="OnRowDataBound" TValue="EmployeeData"></GridEvents>
<GridTemplates>
<DetailTemplate>
@{
var employee = (context as EmployeeData);
// Rendering template only for required rows
if (employee.EmployeeID % 2 == 0)
{
<table class="detailtable" width="100%">
<colgroup>
<col width="35%">
<col width="35%">
<col width="30%">
</colgroup>
<tbody>
. . .
</tbody>
</table>
}
}
</DetailTemplate>
</GridTemplates>
<GridColumns>
. . .
</GridColumns>
</SfGrid>
<style type="text/css" class="cssStyles">
.e-row.e-nodetail .e-detailrowcollapse {
pointer-events:none;
}
.e-row.e-nodetail .e-detailrowcollapse .e-dtdiagonalright {
display:none;
}
</style>
@code{
public void OnRowDataBound(RowDataBoundEventArgs<EmployeeData> args)
{
if(args.Data.EmployeeID % 2 != 0)
{
// Hide and disabling the Details icon present in each row
args.Row.AddClass(new string[] { "e-nodetail"});
}
}
} |