RadzenDataGrid Virtualization and Custom Filter Templates

Hello. I've been trying to get the RadzenDataGrid with virtualization on to work with the filter template but for some reason all of my visible results seem to be one behind. I've included code using a modified version of the Filter Template demo example. I have changed the text at the top to display the current count. The count is changing for the expected filtered items but not the grid display. I did try to simulate using the LoadData async as I am planning to use this with a REST API. What am I doing wrong?

@if (initialEmployees == null)
{
    <p><em>Loading...</em></p>
}
else
{
    <RadzenText TextStyle="TextStyle.H6" TagName="TagName.H2" class="my-4">Current Result Count: @count</RadzenText>
    <RadzenDataGrid @ref="grid"  LoadData="@LoadData"  IsLoading=@isLoading Count="count" Style="height:400px"
                Data=@employees FilterMode="FilterMode.Simple" 
        AllowFiltering="true" AllowPaging="false" AllowSorting="true" 
        TItem="Employee" ColumnWidth="200px"  AllowVirtualization="true" >
        <Columns>
            <RadzenDataGridColumn TItem="Employee" Property="ID" Title="ID" />
            <RadzenDataGridColumn TItem="Employee" Title="Customer" Property="CompanyName" Type="typeof(IEnumerable<string>)" 
                    FilterValue="@selectedCompanyNames" FilterOperator="FilterOperator.Contains" LogicalFilterOperator="LogicalFilterOperator.Or">
                <FilterTemplate>
                    <RadzenDropDown @bind-Value=@selectedCompanyNames Style="width:100%;"
                        Change=@OnSelectedCompanyNamesChange Data="@(companyNames)" AllowClear="true" Multiple="true" />
                </FilterTemplate>
            </RadzenDataGridColumn>
            <RadzenDataGridColumn TItem="Employee" Property="TitleOfCourtesy" Title="Title Of Courtesy" FilterValue="@currentTOC">
                <FilterTemplate>
                    <RadzenDropDown @bind-Value="@currentTOC" TextProperty="Text" ValueProperty="Value" Style="width:100%;"
                                    Change=@OnSelectedTOCChange
                                    Data="@(Enum.GetValues(typeof(TitleOfCourtesy)).Cast<TitleOfCourtesy?>().Select(t => new { Text = $"{t}", Value = t == TitleOfCourtesy.All ? null : t }))" />
                </FilterTemplate>
            </RadzenDataGridColumn>
        </Columns>
    </RadzenDataGrid>
}


@code {
    RadzenDataGrid<Employee> grid;

    TitleOfCourtesy? currentTOC;
    IEnumerable<string> selectedCompanyNames;

    List<string> companyNames = new List<string> {"Vins et alcools Chevalier", "Toms Spezialitäten", "Hanari Carnes", "Richter Supermarkt", "Wellington Importadora", "Centro comercial Moctezuma" };

    public enum TitleOfCourtesy
    {
        Ms,
        Mr,
        All = -1
    }

    public class Employee
    {
        public int ID { get; set; }
        public string CompanyName { get; set; }
        public TitleOfCourtesy TitleOfCourtesy { get; set; }
    }

    void OnSelectedCompanyNamesChange(object value)
    {
        if (selectedCompanyNames != null && !selectedCompanyNames.Any())
        {
            selectedCompanyNames = null;  
        }
    }

    void OnSelectedTOCChange(object value)
    {
        if (currentTOC == TitleOfCourtesy.All)
        {
            currentTOC = null;
        }
    }

    IEnumerable<Employee> employees;
    IEnumerable<Employee> initialEmployees;

    protected override void OnInitialized()
    {
        //randomize the data for more employee variations
        var random = new Random();
        initialEmployees = Enumerable.Range(0, 40).Select(i =>            
            new Employee
            {
                ID = i,
                CompanyName = companyNames[random.Next(companyNames.Count)],
                TitleOfCourtesy = random.NextDouble() >= 0.5 ? TitleOfCourtesy.Mr : TitleOfCourtesy.Ms
            });
    }

    int count;
    bool isLoading = false;

    async Task LoadData(LoadDataArgs args)
    {
        isLoading = true;
        await Task.Yield();
        var query = initialEmployees.AsQueryable();

        if (!string.IsNullOrEmpty(args.Filter))
        {
            query = query.Where(args.Filter);
        }

        if (!string.IsNullOrEmpty(args.OrderBy))
        {
            query = query.OrderBy(args.OrderBy);
        }

        count = query.Count();

        employees = query.Skip(args.Skip.Value).Take(args.Top.Value).ToList();
        isLoading = false;
    }
}

Not sure if anyone else was running into this issue, but I did find a bit of a work around. Not sure if this is the best way to approach it but it is working.

I ended up adjusting the LoadData to intercept any changes made by FilterTemplates and force the grid to reload. I put it before the actual data return since the grid.Reload() causes the LoadData to be rerun anyways. Code for the LoadData changed below.

 private string lastCustomTemplateFilters = "";

    async Task LoadData(LoadDataArgs args)
    {
        isLoading = true;
        await Task.Yield();

        //get the filters for only the columns with custom filter templates
        string currentCustomTemplateFilters = Radzen.QueryableExtension.ToFilterString<Employee>(grid.ColumnsCollection.Where(i => i.FilterTemplate != null));

        //check if the filters were changed through the custom templates
        if (currentCustomTemplateFilters != lastCustomTemplateFilters)
        {
            //adjust the lastCustomTemplatefilters and last filters to show that the reload is caused by a reload
            lastCustomTemplateFilters = currentCustomTemplateFilters;

            //trigger a reload so the grid data actually updates. 
            await grid.Reload();
            return;
        }

        //Following code is the same as before
        var query = initialEmployees.AsQueryable();

        if (!string.IsNullOrEmpty(args.Filter))
        {
            query = query.Where(args.Filter);
        }

        if (!string.IsNullOrEmpty(args.OrderBy))
        {
            query = query.OrderBy(args.OrderBy);
        }

        count = query.Count();

        employees = query.Skip(args.Skip.Value).Take(args.Top.Value).ToList();
        isLoading = false;
    }