fix(Table): ShowColumnList item incorrect if remove column by OnColumnCreating (#3688)

* fix: 修复 OnColumnCreating 顺序不正确问题

* chore: bump version 8.6.3-beta04
This commit is contained in:
Argo Zhang 2024-06-19 14:29:22 +08:00 committed by GitHub
parent ab0bb74de5
commit 7a32c21cf5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 8 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<Version>8.6.3-beta03</Version>
<Version>8.6.3-beta04</Version>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">

View File

@ -978,16 +978,22 @@ public partial class Table<TItem> : ITable, IModelEqualityComparer<TItem> where
{
cols = ColumnOrderCallback(cols).ToList();
}
await ReloadColumnOrdersFromBrowserAsync(cols);
Columns.Clear();
Columns.AddRange(cols.OrderFunc());
InternalResetVisibleColumns();
// 查看是否开启列宽序列化
_clientColumnWidths = await ReloadColumnWidthFromBrowserAsync();
ResetColumnWidth();
if (OnColumnCreating != null)
{
await OnColumnCreating(Columns);
}
InternalResetVisibleColumns();
// set default sortName
var col = Columns.Find(i => i is { Sortable: true, DefaultSort: true });
if (col != null)
@ -996,11 +1002,6 @@ public partial class Table<TItem> : ITable, IModelEqualityComparer<TItem> where
SortOrder = col.DefaultSortOrder;
}
if (OnColumnCreating != null)
{
await OnColumnCreating(Columns);
}
// 获取是否自动查询参数值
_autoQuery = IsAutoQueryFirstRender;