I have an SfTab that contains an SfGrid. In the SfTab HeaderTemplate I want to display a count of the filtered records in the Grid.
<SfTab>
<TabItems>
<TabItem>
<HeaderTemplate>
<div class="e-title">Active</div>
<div style="padding: 0 4px; margin-left: 2px; background-color: var(--button-primary); color: var(--button-primary-text)">@peopleCount</div>
</HeaderTemplate>
@* <ChildContent> *@
@* <TabHeader Text="Active"></TabHeader> *@
@* </ChildContent> *@
<ContentTemplate>
<div style="height: calc(100vh - 15rem);" class="grid-container">
<a name="target"></a>
<span class="error">@ErrorDetails</span>
<SfGrid TValue="Person" ID="StudentGrid" @ref="DefaultGrid" AllowPaging="true" AllowSorting="true" AllowExcelExport="true" AllowReordering="true"
ShowColumnMenu="true" ColumnMenuItems="@menuItems" ShowColumnChooser="true" RowHeight="70" Height="100%">
<SfDataManager Url="api/People" Adaptor="Adaptors.WebApiAdaptor"></SfDataManager>
<GridEvents OnRecordDoubleClick="RecordDoubleClickHandler" TValue="Person" OnActionFailure="@ActionFalure"></GridEvents>
<GridPageSettings PageSize="50" PageSizes="new int[] {50, 100, 150, 200}"></GridPageSettings>
<GridEditSettings AllowAdding="true" AllowEditing="true" Mode="EditMode.Dialog">
When I try
var a = DefaultGrid.GetFilteredRecords();
peopleCount = JsonConvert.DeserializeObject<List<Person>>(JsonConvert.SerializeObject(a)).Count();
as a Databound event, I get a circular reference error.
When I put the same code in the OnAfterRender for the component, @peopleCount is still 0.
Is there a way for me to display the number of Grid Filtered Records on the enclosing Tab Header?