How to use the Property "View" with Radzen datagrid Multiple Selection

Hello I made a DataGrid with Multiple Selection. In the Header Template you can directly select or deselect all items. But if the user apply any filter and try click on the checkbox all items are selected event one who are not visible due to the filter. How can i use the parameters View describe in this page https://www.radzen.com/documentation/blazor/datagrid/ ? I also refer to this stack overflow https://stackoverflow.com/questions/71143034/radzen-datagrid-multiple-selection-only-filtered-items this is the same problem of mine but the answer its really not clear for me.
my code.

@page "/delaisappro"
@using System.Security.Claims
@using Microsoft.AspNetCore.Components.Authorization
@using Microsoft.AspNetCore.Identity
@using OfficeIEL.FeatureDelaisApprovisionnement.Services
@using OfficeIEL.FeatureDelaisApprovisionnement.Data
@using OfficeIEL.Services
@using Radzen
@inject IWebHostEnvironment env
@inject AuthenticationStateProvider AuthenticationStateProvider
@inject IJSRuntime JS
@inject NavigationManager NavigationManager
@inject IDelayApproServices delayservices
@inject ISnackbar Snackbar

<div class="container py-0 pa-0">
    <div class="flex-md-column justify-content-center m-0 text-center">
        <h1>Délais approvisionnement par fournisseur.</h1>
        <div class="d-sm-inline-flex m-2">
            <div class="p-3 d-flex">
                <RadzenCard class="bg-transparent d-flex align-items-end flex-row ">
                    <div class="flex-column">
                        <RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Fournisseur</RadzenText>
                        <RadzenTextBox class="w-100" @bind-Value="Vendor" @oninput="@OnVendorChange" />
                    </div>
                    <RadzenButton Click=@DisplayVendor Icon="search" ButtonStyle="ButtonStyle.Secondary"/>
                </RadzenCard>
            </div>

            <div class="p-3 d-flex">
                <RadzenCard class="bg-transparent d-flex align-items-end flex-row ">
                    <div class="flex-column">
                        <RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Nouveaux délais</RadzenText>
                        <RadzenNumeric ShowUpDown="false" TValue="int?" @bind-Value=@NewDelay Min="1" />
                    </div>
                    <RadzenButton Click=@UpdateDelay Icon="edit_document" ButtonStyle="ButtonStyle.Secondary" class="p-1" />
                </RadzenCard>
            </div>
        </div>
    </div>

    @if (_loading)
    {
    <div class="rz-m-12">
        <RadzenProgressBar Value="100" ShowValue="false" Mode="ProgressBarMode.Indeterminate" />
    </div>
    }
    @if (data.Count() != 0)
    {
        <RadzenDataGrid TItem="DelayAppro" Data="@data" PageSize="12" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
                    AllowFiltering="true" AllowSorting="true" AllowPaging="true" PageSizeOptions="@pageSizeOptions"
                    ShowPagingSummary="@showPagerSummary" PagingSummaryFormat="@pagingSummaryFormat"
                    AllowRowSelectOnRowClick="true" SelectionMode="DataGridSelectionMode.Multiple" @bind-Value=@selectedItems>
            <Columns>
                <RadzenDataGridColumn TItem="DelayAppro" Width="60px" Sortable="false" Filterable="false">
                    <HeaderTemplate>
                        <RadzenCheckBox TriState="false" TValue="bool" Value="@(data.Any(i => selectedItems != null && selectedItems.Contains(i)))"
                                    Change="@(args => selectedItems = args ? data.ToList() : null)" />
                    </HeaderTemplate>
                    <Template Context="item">
                        <RadzenCheckBox TriState="false" Value="@(selectedItems != null && selectedItems.Contains(item))"
                                    TValue="bool" Change=@(args => { if(false) { grid.SelectRow(item); }}) />
                    </Template>
                </RadzenDataGridColumn>
                <RadzenDataGridColumn TItem="DelayAppro" Property="f_no" Title="Fournisseur" Filterable="false" />
                <RadzenDataGridColumn TItem="DelayAppro" Property="Item" Title="Item" />
                <RadzenDataGridColumn TItem="DelayAppro" Property="delais" Title="Délais" Filterable="true" />
                <RadzenDataGridColumn TItem="DelayAppro" Property="Priorite" Title="Priorité" Filterable="false" />
                <RadzenDataGridColumn TItem="DelayAppro" Property="QVS_LastUpdate" Title="Dernière mise à jour" Filterable="false" />
            </Columns>
        </RadzenDataGrid>
        <RadzenButton Click=@test ButtonStyle="ButtonStyle.Secondary" class="p-1">test</RadzenButton>
    }
</div>

Change:

<RadzenCheckBox TriState="false" TValue="bool" Value="@(data.Any(i => selectedItems != null && selectedItems.Contains(i)))"
                                    Change="@(args => selectedItems = args ? data.ToList() : null)" />

to:

<RadzenCheckBox TriState="false" TValue="bool" Value="@(employees.Any(i => selectedEmployees != null && selectedEmployees.Contains(i)))"
                                Change="@(args => selectedEmployees = args ? grid.View.ToList() : null)" />

just use grid.View.ToList() instead of data.ToList(), and I think you also need to create a ref to the grid, like it is done in the example:
https://blazor.radzen.com/datagrid-multiple-selection

<RadzenDataGrid @ref="grid"
.
.
.
RadzenDataGrid<DelayAppro> grid;
1 Like

Thanks a lot for your response. I had the same issue and with your response it´s working fine.
Regards.