Skip to content

Commit b46fc7f

Browse files
authored
refactor(Table): revert ResetVisibleColumns method logic (#8034)
* refactor: 增加 width 更改条件 * refactor: 移除对可见性以及宽度设置逻辑 * chore: bump version 10.6.2-beta02
1 parent d96e94f commit b46fc7f

2 files changed

Lines changed: 7 additions & 14 deletions

File tree

‎src/BootstrapBlazor/BootstrapBlazor.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<Version>10.6.2-beta01</Version>
4+
<Version>10.6.2-beta02</Version>
55
</PropertyGroup>
66

77
<ItemGroup>

‎src/BootstrapBlazor/Components/Table/Table.razor.cs‎

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,17 +1369,6 @@ private void ResetTableColumns()
13691369
if (item == null)
13701370
{
13711371
_tableColumnStates.Add(CreateTableColumnState(col));
1372-
continue;
1373-
}
1374-
1375-
if (!ShowColumnList)
1376-
{
1377-
item.Visible = col.GetVisible(_screenSize);
1378-
}
1379-
1380-
if (!AllowResizing)
1381-
{
1382-
item.Width = col.Width;
13831372
}
13841373
}
13851374
}
@@ -1461,15 +1450,19 @@ private async Task OnTableRenderAsync(bool firstRender)
14611450
/// <para lang="en">Set Column Visible Method</para>
14621451
/// </summary>
14631452
/// <param name="columns"></param>
1464-
public void ResetVisibleColumns(IEnumerable<TableColumnState> columns)
1453+
public void ResetVisibleColumns(IReadOnlyCollection<TableColumnState> columns)
14651454
{
14661455
foreach (var col in columns)
14671456
{
14681457
var column = _tableColumnStates.Find(i => i.Name == col.Name);
14691458
if (column != null)
14701459
{
14711460
column.Visible = col.Visible;
1472-
column.Width = col.Width;
1461+
1462+
if (col.Width.HasValue)
1463+
{
1464+
column.Width = col.Width;
1465+
}
14731466
}
14741467
}
14751468

0 commit comments

Comments
 (0)