diff --git a/src/BootstrapBlazor.Shared/Samples/Table/Tables.razor.cs b/src/BootstrapBlazor.Shared/Samples/Table/Tables.razor.cs index 696db1832bad7753a8bd96055190284556c73104..f4690f0e751cfdc34ec27fd5b92b3a956c294267 100644 --- a/src/BootstrapBlazor.Shared/Samples/Table/Tables.razor.cs +++ b/src/BootstrapBlazor.Shared/Samples/Table/Tables.razor.cs @@ -388,6 +388,20 @@ public partial class Tables ValueList = "true / false", DefaultValue = "false" }, + new() { + Name = nameof(Table.ShowFilterHeader), + Description = "是否显示过滤行", + Type = "boolean", + ValueList = "true / false", + DefaultValue = "false" + }, + new() { + Name = nameof(Table.ShowMultiFilterHeader), + Description = "是否显示多级表头的过滤行", + Type = "boolean", + ValueList = "true / false", + DefaultValue = "false" + }, new() { Name = "ShowSearch", Description = "显示搜索栏", diff --git a/src/BootstrapBlazor.Shared/Samples/Table/TablesHeader.razor b/src/BootstrapBlazor.Shared/Samples/Table/TablesHeader.razor index c87f8ba1df13ade01690f635e6c77535059ba7c2..866ccfbbcc6100c8d53014677a5aaab625526b21 100644 --- a/src/BootstrapBlazor.Shared/Samples/Table/TablesHeader.razor +++ b/src/BootstrapBlazor.Shared/Samples/Table/TablesHeader.razor @@ -5,11 +5,15 @@

数据结构比较复杂的时候,可使用多级表头来展现数据的层次关系

- +

+

通过设置 ShowMultiFilterHeader 值,来控制是否显示过滤行头
+
注意细节,首列单元格合并后导致最后一行表头第一列无单元格,所以需要自行设置样式 border-bottom 与其他单元格一致
+

+
- - + + diff --git a/src/BootstrapBlazor.Shared/wwwroot/css/site.css b/src/BootstrapBlazor.Shared/wwwroot/css/site.css index 2a2a07929ed32acc2eb1a2024da6c053f734a137..9346d5ad5cfdb33cba27d4b786bfddb783bd7755 100644 --- a/src/BootstrapBlazor.Shared/wwwroot/css/site.css +++ b/src/BootstrapBlazor.Shared/wwwroot/css/site.css @@ -1821,3 +1821,17 @@ header .bb-fs { font-size: 86%; color: #c0c4cc; } + +.table-header-group-th1 { + border-bottom-width: 2px !important; + border-bottom-color: var(--bs-secondary); +} + + .table-header-group-th1 .table-cell { + height: 58px; + } + + .table-header-group-th1 .table-cell, + .table-header-group-th2 .table-cell { + justify-content: center !important; + } diff --git a/src/BootstrapBlazor/Components/Table/Table.razor b/src/BootstrapBlazor/Components/Table/Table.razor index c870371c534379ac0f4ecc81f6981f47733adc40..a39e586611c5ac5908f7e280e84a90993a797fee 100644 --- a/src/BootstrapBlazor/Components/Table/Table.razor +++ b/src/BootstrapBlazor/Components/Table/Table.razor @@ -420,74 +420,77 @@ RenderFragment RenderHeader => hasScroll => { @MultiHeaderTemplate } - - @if (ShowDetails()) - { - - } - @if (IsMultipleSelect) - { - - } - @if (ShowLineNo) - { - - } - @if (!IsExcel && ShowExtendButtons && IsExtendButtonsInRowHeader) - { - @RenderExtendButtonsHeader - } - @foreach (var col in GetColumns()) - { - @if (CheckShownWithBreakpoint(col)) + @if (ShowMultiFilterHeader) + { + + @if (ShowDetails()) { - var fieldName = col.GetFieldName(); - var displayName = col.GetDisplayName(); - -
- @if(col.HeaderTemplate != null) - { - @col.HeaderTemplate(col) - } - else - { - @displayName - } - @if (col.Filterable && !ShowFilterHeader) - { - - } - @if (col.Sortable) +
+ } + @if (IsMultipleSelect) + { + + } + @if (ShowLineNo) + { + + } + @if (!IsExcel && ShowExtendButtons && IsExtendButtonsInRowHeader) + { + @RenderExtendButtonsHeader + } + @foreach (var col in GetColumns()) + { + @if (CheckShownWithBreakpoint(col)) + { + var fieldName = col.GetFieldName(); + var displayName = col.GetDisplayName(); + +
+ @if(col.HeaderTemplate != null) + { + @col.HeaderTemplate(col) + } + else + { + @displayName + } + @if (col.Filterable && !ShowFilterHeader) + { + + } + @if (col.Sortable) + { + + } +
+ @if (AllowResizing) { - + } - - @if (AllowResizing) - { - - } -
+ + } } - } - @if (!IsExcel && ShowExtendButtons && !IsExtendButtonsInRowHeader) - { - @RenderExtendButtonsHeader - } - @if (hasScroll) - { - - } - + @if (!IsExcel && ShowExtendButtons && !IsExtendButtonsInRowHeader) + { + @RenderExtendButtonsHeader + } + @if (hasScroll) + { + + } + + } @if (ShowFilterHeader) { diff --git a/src/BootstrapBlazor/Components/Table/Table.razor.cs b/src/BootstrapBlazor/Components/Table/Table.razor.cs index de068570d7baa9ec6ebfb0795449127660924344..ad9a760b4ca92fca7a6af7d4f339f76b040c9ee8 100644 --- a/src/BootstrapBlazor/Components/Table/Table.razor.cs +++ b/src/BootstrapBlazor/Components/Table/Table.razor.cs @@ -524,6 +524,12 @@ public partial class Table : BootstrapComponentBase, IDisposable, ITable [Parameter] public bool ShowFilterHeader { get; set; } + /// + /// 获得/设置 是否显示过滤表头 默认 false 不显示 + /// + [Parameter] + public bool ShowMultiFilterHeader { get; set; } + /// /// 获得/设置 是否显示表脚 默认为 false ///
时间
个人信息
时间
个人信息
个人姓名
-
 
-
-
- -
-
-
@LineNoText
-
+
 
+
+
+ +
+
+
@LineNoText
+