Skip to content

Commit 0958204

Browse files
committed
补充固定列持久化回来时style上的值不正确
refactor:将持久化回来的列宽给到_visibleColumnsCache,以避免style运算出来的值会以默认列宽或200的数值参与运算
1 parent 3398898 commit 0958204

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1435,7 +1435,10 @@ private void ResetTableColumns()
14351435
{
14361436
var item = _tableColumnStates[index];
14371437
var col = columnMap[item.Name];
1438-
col.Fixed = !string.IsNullOrEmpty(item.Name) && stateMap.TryGetValue(item.Name, out var state) ? stateMap[item.Name].Fixed : false;
1438+
col.Fixed = !string.IsNullOrEmpty(item.Name) && stateMap.TryGetValue(item.Name, out var stateF) ? stateMap[item.Name].Fixed : false;
1439+
// 这里一定要使用 stateMap[item.Name].Width 而不是 item.Width 因为 item.Width 可能是 null;
1440+
// 以解决持久化回来时,列宽为_visibleColumnsCache里面列宽为null 的问题导致固定列上style时值不正确的问题
1441+
col.Width = !string.IsNullOrEmpty(item.Name) && stateMap.TryGetValue(item.Name, out var stateW) ? stateMap[item.Name].Width: col.Width;
14391442
if (item.Visible)
14401443
{
14411444
// 增加到可见列缓存集合

0 commit comments

Comments
 (0)