|
<SfGrid @ref="Grid" ID="Grid" DataSource="@Employees">
<GridEvents DetailDataBound="DetailDataBound" DataBound="DataBound" TValue="EmployeeData"></GridEvents>
..
..
</SfGrid>
@code{
public bool firstrender { get; set; } = true;
public async Task DataBound()
{
if (firstrender)
{
var dotNetReference = DotNetObjectReference.Create(this);
await Runtime.InvokeAsync<string>("detail", dotNetReference);
firstrender = false;
}
}
public async Task DetailDataBound(DetailDataBoundEventArgs<EmployeeData> args)
{
if (target != null)
{
if (target == args.Data)
{
return;
}
await Grid.DetailExpandCollapseRow(target);
}
target = args.Data;
}
[JSInvokable("DetailCollapse")]
public void DetailRowCollapse()
{
target = null;
}
} |
|
var dotnetInstance;
function detail(dotnet) {
dotnetInstance = dotnet; // dotnet instance to invoke C# method from JS
}
document.addEventListener('click', function (args) {
if (args.target.classList.contains("e-dtdiagonaldown") || args.target.classList.contains("e-detailrowexpand")) {
dotnetInstance.invokeMethodAsync('DetailCollapse'); // call C# method from javascript function
}
}) |
|
<head>
..
<script src="~/detailexpand.js"></script>
..
</head> |
@code{
private
EmployeeData
? currentlyExpandedRow;
private async Task OnRowExpanding(DetailsExpandedEventArgs< EmployeeData > args)
{
if (currentlyExpandedRow is not null && currentlyExpandedRow != args.Data)
{
await Grid.ExpandCollapseDetailRowAsync(currentlyExpandedRow);
}
currentlyExpandedRow = args.Data;
}
}
Hi
Im Im,
Before proceeding with the reporting problem, we require some additional
clarification from your end. Please share the following details to proceed
further at our end:
The above-requested details will be very helpful for us to validate the reported query at our end and provide a solution as early as possible.
Regards,
Prathap S