Skip to content

Commit d3d72a6

Browse files
Lambert LeeArgoZhang
authored andcommitted
!3782 doc(#I6B4WI): update TablesDynamicObject demos
* update TablesDynamicObject demos * update TableFooter demos
1 parent f66a332 commit d3d72a6

5 files changed

Lines changed: 73 additions & 62 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<div>
2+
<Table TItem="CustomDynamicColumnsObjectData" Items="CustomDynamicItems"
3+
IsStriped="true" IsBordered="true" ShowToolbar="true" ShowColumnList="true" ShowDefaultButtons="false" ShowRefresh="false">
4+
<TableColumns>
5+
<TableColumn @bind-Field="@context.Fix" Sortable="true" Filterable="true" />
6+
@foreach (var element in StaticColumnList)
7+
{
8+
<TableColumn Field="@element" FieldName="@element" Text="@element" Sortable="true" Filterable="true">
9+
<Template Context="v">
10+
<div>Template - @v.Value</div>
11+
</Template>
12+
</TableColumn>
13+
}
14+
</TableColumns>
15+
</Table>
16+
</div>
17+
18+
@code {
19+
[NotNull]
20+
private IEnumerable<CustomDynamicColumnsObjectData>? CustomDynamicItems { get; set; }
21+
22+
private static List<string> StaticColumnList => new() { "A", "B", "C", "Z" };
23+
24+
/// <summary>
25+
/// OnInitialized
26+
/// </summary>
27+
protected override void OnInitialized()
28+
{
29+
base.OnInitialized();
30+
CustomDynamicItems = Enumerable.Range(1, 10).Select(index => new CustomDynamicColumnsObjectData(index.ToString(), StaticColumnList.ToDictionary(d => d, d => (object?)$"{d}{index}")));
31+
}
32+
}

src/BootstrapBlazor.Shared/Samples/Table/TablesDynamicObject.razor.cs renamed to src/BootstrapBlazor.Shared/Demos/Table/TablesDynamicObject/TablesDynamicObjectMetaObjectProvider.razor

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
1-
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
2-
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3-
// Website: https://www.blazor.zone or https://argozhang.github.io/
4-
5-
namespace BootstrapBlazor.Shared.Samples.Table;
6-
7-
/// <summary>
8-
///
9-
/// </summary>
10-
public partial class TablesDynamicObject
11-
{
12-
[NotNull]
13-
private IEnumerable<CustomDynamicColumnsObjectData>? CustomDynamicItems { get; set; }
14-
1+
<div>
2+
<Table TItem="CustomDynamicData" OnQueryAsync="OnQueryAsync"
3+
IsStriped="true" IsBordered="true" ShowToolbar="true" ShowColumnList="true" ShowDefaultButtons="false" ShowRefresh="false">
4+
<TableColumns>
5+
<TableColumn @bind-Field="@context.Fix" Sortable="true" Filterable="true" />
6+
@foreach (var element in DynamicColumnList)
7+
{
8+
<TableColumn Field="@element.ToString()" FieldName="@element.ToString()" Text="@element" Sortable="true" Filterable="true">
9+
<Template Context="v">
10+
<div>Template - @v.Value</div>
11+
</Template>
12+
</TableColumn>
13+
}
14+
</TableColumns>
15+
</Table>
16+
</div>
17+
18+
@code {
1519
private static List<string> StaticColumnList => new() { "A", "B", "C", "Z" };
1620

1721
[NotNull]
1822
private List<string>? DynamicColumnList { get; set; }
1923

2024
/// <summary>
21-
/// <inheritdoc/>
25+
/// OnInitialized
2226
/// </summary>
2327
protected override void OnInitialized()
2428
{
@@ -27,9 +31,6 @@ protected override void OnInitialized()
2731
// 构造动态列
2832
var now = DateTime.Now;
2933
DynamicColumnList = Enumerable.Range(1, 5).Select(index => now.AddMinutes(-1 * index).ToString("HH:mm")).ToList();
30-
31-
CustomDynamicItems = Enumerable.Range(1, 10)
32-
.Select(index => new CustomDynamicColumnsObjectData(index.ToString(), StaticColumnList.ToDictionary(d => d, d => (object?)$"{d}{index}")));
3334
}
3435

3536
private readonly static Random random = new();

src/BootstrapBlazor.Shared/Locales/en.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@
7979
"TableDialogNormalSure": "Sure"
8080
},
8181
"BootstrapBlazor.Shared.Samples.Table.TablesDynamicObject": {
82-
"H1": "Table table",
83-
"H2": "Use the <code>IDynamicMetaObjectProvider</code> class as a data source",
84-
"P1": "IDynamicMetaObjectProvider Collection",
85-
"P2": "Use the <code>IDynamicMetaObjectProvider</code> data collection as the data source by setting the <code>Items</code> data source",
86-
"P3": "IDynamicObject collection",
87-
"P4": "Use the <code>IDynamicObject</code> data collection as the data source by setting the <code>Items</code> data source"
82+
"TablesDynamicObjectTitle": "Table table",
83+
"TablesDynamicObjectDescription": "Use the <code>IDynamicMetaObjectProvider</code> class as a data source",
84+
"TablesDynamicObjectMetaObjectProviderTitle": "IDynamicMetaObjectProvider Collection",
85+
"TablesDynamicObjectMetaObjectProviderIntro": "Use the <code>IDynamicMetaObjectProvider</code> data collection as the data source by setting the <code>Items</code> data source",
86+
"TablesDynamicObjectIDynamicObjectTitle": "IDynamicObject collection",
87+
"TablesDynamicObjectIDynamicObjectIntro": "Use the <code>IDynamicObject</code> data collection as the data source by setting the <code>Items</code> data source"
8888
},
8989
"BootstrapBlazor.Shared.Samples.Table.TablesPages": {
9090
"TablesPagesTitle": "Table",

src/BootstrapBlazor.Shared/Locales/zh.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@
7979
"TableDialogNormalSure": "确定"
8080
},
8181
"BootstrapBlazor.Shared.Samples.Table.TablesDynamicObject": {
82-
"H1": "Table 表格",
83-
"H2": "使用 <code>IDynamicMetaObjectProvider</code> 类作为数据源",
84-
"P1": "IDynamicMetaObjectProvider 集合",
85-
"P2": "通过设置 <code>Items</code> 数据源,使用 <code>IDynamicMetaObjectProvider</code> 数据集合作为数据源",
86-
"P3": "IDynamicObject 集合",
87-
"P4": "通过设置 <code>Items</code> 数据源,使用 <code>IDynamicObject</code> 数据集合作为数据源"
82+
"TablesDynamicObjectTitle": "Table 表格",
83+
"TablesDynamicObjectDescription": "使用 <code>IDynamicMetaObjectProvider</code> 类作为数据源",
84+
"TablesDynamicObjectMetaObjectProviderTitle": "IDynamicMetaObjectProvider 集合",
85+
"TablesDynamicObjectMetaObjectProviderIntro": "通过设置 <code>Items</code> 数据源,使用 <code>IDynamicMetaObjectProvider</code> 数据集合作为数据源",
86+
"TablesDynamicObjectIDynamicObjectTitle": "IDynamicObject 集合",
87+
"TablesDynamicObjectIDynamicObjectIntro": "通过设置 <code>Items</code> 数据源,使用 <code>IDynamicObject</code> 数据集合作为数据源"
8888
},
8989
"BootstrapBlazor.Shared.Samples.Table.TablesPages": {
9090
"TablesPagesTitle": "Table 表格",
Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,17 @@
11
@page "/tables/dynamicobject"
22
@inject IStringLocalizer<TablesDynamicObject> Localizer
33

4-
<h3>@Localizer["H1"]</h3>
5-
<h4>@((MarkupString)Localizer["H2"].Value)</h4>
4+
<h3>@Localizer["TablesDynamicObjectTitle"]</h3>
5+
<h4>@((MarkupString)Localizer["TablesDynamicObjectDescription"].Value)</h4>
66

7-
<DemoBlock Title="@Localizer["P1"]" Introduction="@Localizer["P2"]" Name="IDynamicMetaObjectProvider">
8-
<Table TItem="CustomDynamicData" OnQueryAsync="OnQueryAsync"
9-
IsStriped="true" IsBordered="true" ShowToolbar="true" ShowColumnList="true" ShowDefaultButtons="false" ShowRefresh="false">
10-
<TableColumns>
11-
<TableColumn @bind-Field="@context.Fix" Sortable="true" Filterable="true" />
12-
@foreach (var element in DynamicColumnList)
13-
{
14-
<TableColumn Field="@element.ToString()" FieldName="@element.ToString()" Text="@element" Sortable="true" Filterable="true">
15-
<Template Context="v">
16-
<div>Template - @v.Value</div>
17-
</Template>
18-
</TableColumn>
19-
}
20-
</TableColumns>
21-
</Table>
7+
<DemoBlock Title="@Localizer["TablesDynamicObjectMetaObjectProviderTitle"]"
8+
Introduction="@Localizer["TablesDynamicObjectMetaObjectProviderIntro"]"
9+
Name="MetaObjectProvider"
10+
Demo="typeof(Demos.Table.TablesDynamicObject.TablesDynamicObjectMetaObjectProvider)">
2211
</DemoBlock>
2312

24-
<DemoBlock Title="@Localizer["P3"]" Introduction="@Localizer["P4"]" Name="IDynamicObject">
25-
<Table TItem="CustomDynamicColumnsObjectData" Items="CustomDynamicItems"
26-
IsStriped="true" IsBordered="true" ShowToolbar="true" ShowColumnList="true" ShowDefaultButtons="false" ShowRefresh="false">
27-
<TableColumns>
28-
<TableColumn @bind-Field="@context.Fix" Sortable="true" Filterable="true" />
29-
@foreach (var element in StaticColumnList)
30-
{
31-
<TableColumn Field="@element" FieldName="@element" Text="@element" Sortable="true" Filterable="true">
32-
<Template Context="v">
33-
<div>Template - @v.Value</div>
34-
</Template>
35-
</TableColumn>
36-
}
37-
</TableColumns>
38-
</Table>
13+
<DemoBlock Title="@Localizer["TablesDynamicObjectIDynamicObjectTitle"]"
14+
Introduction="@Localizer["TablesDynamicObjectIDynamicObjectIntro"]"
15+
Name="IDynamicObject"
16+
Demo="typeof(Demos.Table.TablesDynamicObject.TablesDynamicObjectIDynamicObject)">
3917
</DemoBlock>

0 commit comments

Comments
 (0)