diff --git a/src/BootstrapBlazor.Server/Components/Components/MergeTableRow.razor b/src/BootstrapBlazor.Server/Components/Components/MergeTableRow.razor new file mode 100644 index 00000000000..874fed40594 --- /dev/null +++ b/src/BootstrapBlazor.Server/Components/Components/MergeTableRow.razor @@ -0,0 +1,39 @@ +@if (Context.Row.Id == 1) +{ + + @Context.Row.DateTime + @Context.Row.Name + @Context.Row.Address + @Context.Row.Count + +} +else if (Context.Row.Id == 2) +{ + + @Context.Row.Name + @Context.Row.Address + @Context.Row.Count + +} +else if (Context.Row.Id == 3) +{ + + @Context.Row.Address + @Context.Row.Count + +} +else if (Context.Row.Id == 4) +{ + + @Context.Row.Count + +} +else +{ + + @Context.Row.DateTime + @Context.Row.Name + @Context.Row.Address + @Context.Row.Count + +} diff --git a/src/BootstrapBlazor.Server/Components/Components/MergeTableRow.razor.cs b/src/BootstrapBlazor.Server/Components/Components/MergeTableRow.razor.cs new file mode 100644 index 00000000000..7f522a676fc --- /dev/null +++ b/src/BootstrapBlazor.Server/Components/Components/MergeTableRow.razor.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the Apache 2.0 License +// See the LICENSE file in the project root for more information. +// Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone + +namespace BootstrapBlazor.Server.Components.Components; + +/// +/// 自定义行组件 +/// +public partial class MergeTableRow +{ + /// + /// 获得/设置 行上下文数据实例 + /// + [Parameter] + [NotNull] + public TableRowContext? Context { get; set; } +} diff --git a/src/BootstrapBlazor.Server/Components/Samples/Table/TablesRow.razor b/src/BootstrapBlazor.Server/Components/Samples/Table/TablesRow.razor index e8eccf749e3..24c6fe45d6e 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/Table/TablesRow.razor +++ b/src/BootstrapBlazor.Server/Components/Samples/Table/TablesRow.razor @@ -146,7 +146,25 @@ -
@((MarkupString)Localizer["RowTemplateDesc"].Value)
+ + + + + + + + + + +
+
+ + +
@((MarkupString)Localizer["RowContentTemplateDesc"].Value)
RowContentTemplate template, you can implement custom row cell linkage logic by sub-packaging components to achieve performance optimization and avoid the problem of refreshing the entire table component after linkage due to cell data refresh.", + "RowContentTemplateDesc": "In this example, a custom component is used to select a date, link the quantity column, randomly generate a random number, and save it to the original data, so there is no need to refresh the entire Table component.", "RowTemplateTitle": "Row Template", - "RowTemplateIntro": "By setting the RowTemplate template, you can implement custom row cell linkage logic by sub-packaging components to achieve performance optimization and avoid the problem of refreshing the entire table component after linkage due to cell data refresh.", - "RowTemplateDesc": "In this example, a custom component is used to select a date, link the quantity column, randomly generate a random number, and save it to the original data, so there is no need to refresh the entire Table component." + "RowTemplateIntro": "By setting the RowTemplate template, you can implement the row merging function according to your own business logic" }, "BootstrapBlazor.Server.Components.Samples.Table.TablesDynamic": { "TablesDynamicTitle": "Table Dynamic", diff --git a/src/BootstrapBlazor.Server/Locales/zh-CN.json b/src/BootstrapBlazor.Server/Locales/zh-CN.json index bdfc8ab39be..752915f9235 100644 --- a/src/BootstrapBlazor.Server/Locales/zh-CN.json +++ b/src/BootstrapBlazor.Server/Locales/zh-CN.json @@ -5528,9 +5528,11 @@ "ClickToSelectP3": "当前选中行:", "ClickToSelectNoneText": "无", "PlaceHolder": "不可为空,50字以内", + "RowContentTemplateTitle": "行内容模板", + "RowContentTemplateIntro": "通过设置 RowContentTemplate 模板,可通过分装组件的方式实现自定义行内单元格联动逻辑,达到性能最优化,避免单元格数据刷新导致联动后需要刷新整个表格组件的问题,可用于销售类软件,调整单价时总价列变化需求", + "RowContentTemplateDesc": "本例中通过自定义组件,实现选择日期后,联动数量列,随机生成一个随机数字,并且保存到原始数据中,从而不需要刷新整个 Table 组件", "RowTemplateTitle": "行模板", - "RowTemplateIntro": "通过设置 RowTemplate 模板,可通过分装组件的方式实现自定义行内单元格联动逻辑,达到性能最优化,避免单元格数据刷新导致联动后需要刷新整个表格组件的问题,可用于销售类软件,调整单价时总价列变化需求", - "RowTemplateDesc": "本例中通过自定义组件,实现选择日期后,联动数量列,随机生成一个随机数字,并且保存到原始数据中,从而不需要刷新整个 Table 组件" + "RowTemplateIntro": "通过设置 RowTemplate 模板,可以根据自己的业务逻辑实现行合并功能" }, "BootstrapBlazor.Server.Components.Samples.Table.TablesDynamic": { "TablesDynamicTitle": "Table 表格",