Skip to content

Commit 4bba10d

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

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

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

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

0 commit comments

Comments
 (0)