From 3d5ed5e82ee896b24dd041a468dbf14274d8d9d8 Mon Sep 17 00:00:00 2001 From: Tony <6914529@qq.com> Date: Tue, 26 May 2026 22:20:50 +0800 Subject: [PATCH] =?UTF-8?q?feat(Table):=20=E5=BD=93=E8=A1=A8=E6=A0=BCShowL?= =?UTF-8?q?ineNo=E5=B1=9E=E6=80=A7=E4=B8=BAtrue=EF=BC=8C=E4=B8=94=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E4=B8=AD=E6=9C=89=E5=88=97=E5=B1=9E=E6=80=A7Fixed?= =?UTF-8?q?=E4=B8=BAtrue=E6=97=B6=EF=BC=8CFixedLineNoColumn=E8=AF=A5?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E8=87=AA=E5=8A=A8=E4=B8=BAtrue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit feat(Table): 当表格ShowLineNo属性为true,且表格中有列属性Fixed为true时,FixedLineNoColumn该属性自动为true --- .../Components/Table/Table.razor.Toolbar.cs | 4 ++-- src/BootstrapBlazor/Components/Table/Table.razor.cs | 11 ++++++++++- .../Components/Table/TableColumnClientStatus.cs | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/BootstrapBlazor/Components/Table/Table.razor.Toolbar.cs b/src/BootstrapBlazor/Components/Table/Table.razor.Toolbar.cs index 91ff894c37c..082c743d553 100644 --- a/src/BootstrapBlazor/Components/Table/Table.razor.Toolbar.cs +++ b/src/BootstrapBlazor/Components/Table/Table.razor.Toolbar.cs @@ -317,8 +317,8 @@ public Func? ShowDeleteButtonCallback public bool FixedDetailRowHeaderColumn { get; set; } /// - /// 获得/设置 是否固定 LineNo 列 默认为 false 不固定 - /// Gets or sets Whether to fix LineNo Column. Default false + /// 获得/设置 是否固定 LineNo 列 默认为 false 不固定,当表格中存在固定列时,该属性值自动设为 true + /// Gets or sets Whether to fix LineNo Column. Default false.When there are fixed columns in the table, the value of this property is automatically set to true /// [Parameter] public bool FixedLineNoColumn { get; set; } diff --git a/src/BootstrapBlazor/Components/Table/Table.razor.cs b/src/BootstrapBlazor/Components/Table/Table.razor.cs index 9d01aad5366..0eae33b8c68 100644 --- a/src/BootstrapBlazor/Components/Table/Table.razor.cs +++ b/src/BootstrapBlazor/Components/Table/Table.razor.cs @@ -1610,7 +1610,7 @@ private RenderFragment RenderContentRow(TItem item) => builder => // 合并单元格情况 colIndex--; continue; - } + } // 获得单元格参数 var cellArgs = GetCellArgs(item, col, ref colIndex); @@ -1635,6 +1635,15 @@ private RenderFragment RenderContentRow(TItem item) => builder => }; builder.AddContent(0, RenderContentCell(context)); + + if (ShowLineNo && col.Fixed&& !FixedLineNoColumn) + { + // 当有显示行号列时,且当表格中列固定时,行号列也自动固定 + // 避免未设置行号列固定时,表格中其他列固定导致行号列未固定的情况,表格横向滑动时行号会隐藏 + FixedLineNoColumn = col.Fixed; + // 这里必须处理一次,以解决持久化加载时,表头先渲染导致固定列不正常 + StateHasChanged(); + } } }; diff --git a/src/BootstrapBlazor/Components/Table/TableColumnClientStatus.cs b/src/BootstrapBlazor/Components/Table/TableColumnClientStatus.cs index a8099be4cc0..a60965bfc55 100644 --- a/src/BootstrapBlazor/Components/Table/TableColumnClientStatus.cs +++ b/src/BootstrapBlazor/Components/Table/TableColumnClientStatus.cs @@ -21,8 +21,8 @@ public class TableColumnClientStatus public List Columns { get; set; } = []; /// - /// 表格宽度 - /// Table Width + /// 表格宽度,当值为 0 时表示表格宽度自适应 + /// Table Width, when the value is 0, it means the table width is auto /// [JsonPropertyName("table")] public int TableWidth { get; set; }