Hello,
I've checked some of the topics regarding this issue but could not find the answer to my problem. As the title states, I have been struggling with the performance of the filtering and sorting. The datagrid has now 2000 records and takes about 7-8s to filter/order on the first time, then it works as fast as a rocket. I have checked also the performance page in the docs but could not get anything useful either.
I would also like to clarify that the page rendering is quite fast so the records seem not to be the problem.
I will add the code snippet (.razor and .razor.cs).
<RadzenDataGrid TItem="Recibo" Responsive="true" Data="@RecibosPendientes" AllowPaging="true" PageSize="10" AllowFiltering="true" AllowSorting="true" PagingSummaryFormat="{2} recibos" ShowPagingSummary="true"
AllowAlternatingRows="true" AllowFilterDateInput="false" ColumnWidth="150px" PagerAlwaysVisible="true" PageNumbersCount="3" FilterMode="FilterMode.Advanced"
PrevPageTitle="Página anterior" PrevPageAriaLabel="Retroceder página"AndOperatorText="Y" ApplyFilterText="Aplicar" ClearFilterText="Borrar" ContainsText="Contiene" DoesNotContainText="No contiene" EndsWithText="Termina en..."
EqualsText="Igual a" FilterText="Filtro" FirstPageTitle="Primera página" GreaterThanOrEqualsText="Mayor o igual que" GreaterThanText="Mayor que" IsEmptyText="Está vacío" IsNotEmptyText="No está vacío" IsNotNullText="No es nulo"
IsNullText="Es nulo" LastPageTitle="Última página" LessThanOrEqualsText="Menor o igual que" LessThanText="Menor que" LogicalOperatorArialLabel="Filtro de operador lógico" NextPageAriaLabel="Avanzar página" NextPageTitle="Siguiente página"
NotEqualsText="No es igual a" OrOperatorText="O" PageAriaLabelFormat="Ir a página {0}" PageSizeText="Registros por página" StartsWithText="Empieza por" PageTitleFormat="Página {0}" ShowMultiColumnSortingIndex="true"
AllowMultiColumnSorting="true" RowSelect="@ClickOnRow" >
<Columns>
<RadzenDataGridColumn TItem="Recibo" Title="Fecha" Property="Fecha" FormatString="{0:d}" SortOrder="SortOrder.Ascending"></RadzenDataGridColumn>
<RadzenDataGridColumn TItem="Recibo" Property="NRecibo" Title="Nº recibo"></RadzenDataGridColumn>
<RadzenDataGridColumn TItem="Recibo" Title="Nº póliza" Property="NPoliza"></RadzenDataGridColumn>
<RadzenDataGridColumn TItem="Recibo" Property="NIFAgente" Title="NIF Agente"></RadzenDataGridColumn>
<RadzenDataGridColumn TItem="Recibo" Property="Tomador" Title="Tomador"></RadzenDataGridColumn>
<RadzenDataGridColumn TItem="Recibo" Property="Producto" Title="Producto"></RadzenDataGridColumn>
<RadzenDataGridColumn TItem="Recibo" Property="Importe" Title="Importe">
<Template Context='data'>
<RadzenRow>
@data.Importe
<RadzenText Text="€" Style="margin-left: -10px" />
</RadzenRow>
</Template>
</RadzenDataGridColumn>
<RadzenDataGridColumn TItem="Recibo" Property="Estado" Title="Estado" Visible="true">
<Template Context='data'>
@if (data.Estado == 1)
{
<RadzenIcon Icon="done" Style="color:green">
</RadzenIcon>
}
else if (data.Estado == 2)
{
<RadzenIcon Icon="close" Style="color:red">
</RadzenIcon>
}
</Template>
</RadzenDataGridColumn>
</Columns>
</RadzenDataGrid>
public IList<Recibo> RecibosPendientes { get; set; }
protected override async Task OnInitializedAsync()
{
RecibosPendientes = new List<Recibo>();
Random random = new Random();
string NombresProductos = "Vida,Salud,Hogar,Accidentes,Mascotas,Decesos,Autos,Ahorro,Legal";
string NombreGente= "Pedro Martinez,Juan Lopez,Maria Sala,Silvia Rodriguez,Paula Mendoza,Javier Rosales";
string[] Prods = NombresProductos.Split(new char[] { ','}, StringSplitOptions.RemoveEmptyEntries);
string[] Gente = NombreGente.Split(new char[] { ','}, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < 2000; i++) {
RecibosPendientes.Add(
new Recibo()
{
Fecha = new DateTime(random.Next(2021, 2024), random.Next(1, 13), random.Next(1, 29)),
NRecibo = random.Next(1000000),
NPoliza = random.Next(1000000),
NIFAgente = Convert.ToBoolean(random.Next(2)),
Tomador = Gente[random.Next(Gente.Length)],
Producto = Prods[random.Next(Prods.Length)],
Importe = random.Next(1, 101) + (decimal)random.Next(100)/100,
Estado = random.Next(1, 3),
});
}
}
protected async System.Threading.Tasks.Task ClickOnRow(Recibo args)
{
NavigationManager.NavigateTo($"/");
}
}
}
The List "RecibosPendientes" is defined in a file Recibos.cs and only has those fields.
I hope you could help me solve this problem or at least guide me in the correct direction.
Thanks in advance.