DataGrid loading

I have a problem with the speed of operation in the DataGrid component. It consists in the fact that each opening of a table and then selecting or deselecting data in the same table causes multiple readings of data from MSSQL. I first noticed the larger tables as they took longer than usual to open. I ran SQL Server Profiler and came to the startling fact that a table of somewhere around 1500 rows is called 100 or more times before the data is loaded. As I was playing with the loaded data, I thought that I had made a mistake somewhere and caused the problem, so I checked the same things on other smaller and untouched tables in terms of data manipulation and came to the conclusion that the same problem is happening with them too, although in fewer repetitions. So the number of query repetitions is proportional to the number of data in the table. The matter is further complicated because the same problem appears at the moment of the SelectRow functionality, so on larger tables after selecting the data you have to wait 4-5 seconds.

All tables are virtualized and they all work in SingleSelect mode.

Am I missing something in my setup when I get this problem?

Example of one datagird:

        <RadzenColumn SizeMD=12>
            <RadzenDataGrid @ref="grid0" ColumnWidth="200px" AllowFiltering="false" FilterMode="FilterMode.Advanced" AllowPaging="false" AllowColumnResize="true" AllowSorting="true" ShowPagingSummary="false" PageSize="50"
                            Data="@bRORG" TItem="Bezra.Models.BEZRA.BRORG" RowSelect="@SelRow" RowDoubleClick="@EditRow" AllowVirtualization="true" Density="Density.Compact" Style="min-width: 1000px; max-width: 100%; max-height: 600px" Responsive="true"
                            SelectionMode="DataGridSelectionMode.Single" @bind-Value="selectedOrg">
                <Columns>
                    <RadzenDataGridColumn TItem="Bezra.Models.BEZRA.BRORG" Property="ORGID" Title="O R G I D">
                    </RadzenDataGridColumn>
                    <RadzenDataGridColumn TItem="Bezra.Models.BEZRA.BRORG" Property="NAZIV" Title="N A Z I V">
                    </RadzenDataGridColumn>
                    <RadzenDataGridColumn TItem="Bezra.Models.BEZRA.BRORG" Property="ADRESA" Title="A D R E S A">
                    </RadzenDataGridColumn>
                    <RadzenDataGridColumn TItem="Bezra.Models.BEZRA.BRORG" Property="MESTO" Title="M E S T O">
                    </RadzenDataGridColumn>
                    <RadzenDataGridColumn TItem="Bezra.Models.BEZRA.BRORG" Property="NIVO" Title="N I V O">
                    </RadzenDataGridColumn>
                    <RadzenDataGridColumn TItem="Bezra.Models.BEZRA.BRORG" Property="EXTUPDATE" Title="Izmenjeno">
                        <Template Context="data">
                            <RadzenCheckBox @bind-Value=@data.EXTUPDATE ReadOnly="true"></RadzenCheckBox>
                        </Template>
                    </RadzenDataGridColumn>
                    <RadzenDataGridColumn TItem="Bezra.Models.BEZRA.BRORG" Property="CMPNID" Title="C M P N I D">
                    </RadzenDataGridColumn>
                    <RadzenDataGridColumn TItem="Bezra.Models.BEZRA.BRORG" Property="NEAKT" Title="Neaktivno" Width="70px">
                        <Template Context="data">
                            <RadzenCheckBox @bind-Value=@data.NEAKT ReadOnly="true"></RadzenCheckBox>
                        </Template>
                    </RadzenDataGridColumn>
                </Columns>

            </RadzenDataGrid>

Maybe you can use ToList() in your case to avoid database calls.

Lots of changes but it does the trick. Thank you.

One question.
How does this change impact reloading after record update or adding a new record?

You might need to manually reload since in this case the DataGrid will not query your database on every state change of the page/component.

It seemed to me. I just wanted to confirm. Thank you.