ant-design-blazor / ant-design-blazor/ant-design-blazor

Table Component render to much times

Aperta
#4,130 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
C#
Stelle
6.2k
Fork
1.2k
Merge medio
1g 22h
PR unite (30g)
1

Descrizione

The same amount (80 columns, 20 rows) of data, antTable and other Table components comparison:

- switch row
- Render times of other components = 160 times
- Render times of ant component = 5200 times
- Click the empty button
- Render times of other components = 1600 times
- Render times of ant component = 4960 times
- Entering the page for the first time
- Render times of other components = 1600 times
- Render times of ant component =400+400+1440+4240+4400=10880 times

```
@page "/anttable"


AntTable





AddColumnAddRow

@{

var index = 0;
foreach (var column in Columns)
{
Console.WriteLine("test");
if(index < FixedColumnCount)
{

}
else
{

}
index++;
}

@{
//Console.WriteLine("Action");
action
}

}






@code {
private int AddTimes = 1;
public int FixedColumnCount { get; set; } = 2;
public string ScorllX { get; set; } = "0";
public List> DataList { get; set; } = new();
public List Columns { get; set; } = new();
public IEnumerable> Selection;
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();

for(var i = 0; i < 80; i++)
{
AddColumn();
}
for (var i = 0; i < 20; i++)
{
AddRow();
}
}
private void AddColumn()
{
for (var t = 0; t < AddTimes; t++)
{
var column = $"c{Columns.Count}";
Columns.Add(column);
for (var j = 0; j < DataList.Count; j++)
{
var item = DataList[j];
item[column] = $"r{j}-{column}";
}
}
ScorllX = (80 * Columns.Count).ToString();
}
private void AddRow()
{
for (var t = 0; t < AddTimes; t++)
{
var item = new Dictionary();
for (var i = 0; i < Columns.Count; i++)
{
var column = $"c{i}";
item[column] = $"r{DataList.Count}-{column}";
}
DataList.Add(item);
}
}
protected override bool ShouldRender()
{
Console.WriteLine("ShouldRender");
return base.ShouldRender();
}
private void OnRowClick(AntDesign.TableModels.RowData> rowData)
{
//rowData.Selected = !rowData.Selected;
//Selection = new List> { rowData.Data };
}
}
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.