Grid:
<EjsGrid DataSource="@checks" AllowPaging="true" AllowSorting="true" AllowFiltering="true" AllowExcelExport="true" ModelType="@checkModel" AllowSelection="true">
<GridSelectionSettings Mode="Syncfusion.EJ2.Blazor.Grids.SelectionMode.Row" Type="SelectionType.Single"></GridSelectionSettings>
<GridEvents TValue="DTOs.APIs.Checks" RowSelected="@SelectRow" RowDeselected="@(()=> selectedCheck = null)"></GridEvents>
<GridColumns>
<GridColumn HeaderText="Check Number" Field="CheckNumber"></GridColumn>
<GridColumn HeaderText="Check Date" Field="CheckDate" Format="yMd"></GridColumn>
<GridColumn HeaderText="Check Amount" Field="Amount" Format="C2"></GridColumn>
</GridColumns>
</EjsGrid>
Callback:
void SelectRow(RowSelectEventArgs<DTOs.APIs.Checks> args)
{
GetCheckDetails(args.Data);
}
private void GetCheckDetails(DTOs.APIs.Checks check)
{
selectedCheck = check;
StateHasChanged();
}
When I click the first row I get this error in the console:
It only seems to effect the first row, and when I sort and the first row say becomes the last, the last row is what causes the error.
Also, when I unselect a row then select a row the screen flashes twice then shows the new row. Is there another event I should be listening for instead of "RowDeselected"?