Skip to content

Commit 046c03e

Browse files
Lambert LeeArgoZhang
authored andcommitted
!3759 doc(#I6AJ3E): update the table component lookup demo
* update the table component lookup demo
1 parent e03d20a commit 046c03e

5 files changed

Lines changed: 59 additions & 64 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
@inject IStringLocalizer<Foo> Localizer
2+
3+
<div>
4+
@if (Items != null)
5+
{
6+
<Table TItem="Foo" Items="@Items.Take(3)">
7+
<TableColumns>
8+
<TableColumn @bind-Field="@context.DateTime" Width="180" />
9+
<TableColumn @bind-Field="@context.Name" />
10+
<TableColumn @bind-Field="@context.Complete" LookupServiceKey="Foo.Complete" />
11+
</TableColumns>
12+
</Table>
13+
}
14+
</div>
15+
16+
@code {
17+
/// <summary>
18+
/// Foo 类为Demo测试用,如有需要请自行下载源码查阅
19+
/// Foo class is used for Demo test, please download the source code if necessary
20+
/// https://gitee.com/LongbowEnterprise/BootstrapBlazor/blob/main/src/BootstrapBlazor.Shared/Data/Foo.cs
21+
/// </summary>
22+
[NotNull]
23+
private List<Foo>? Items { get; set; }
24+
25+
/// <summary>
26+
/// OnInitialized
27+
/// </summary>
28+
protected override async Task OnInitializedAsync()
29+
{
30+
await base.OnInitializedAsync();
31+
32+
await Task.Delay(200);
33+
//获取随机数据
34+
//Get random data
35+
Items = Foo.GenerateFoo(Localizer);
36+
}
37+
}

src/BootstrapBlazor.Shared/Locales/en.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5501,13 +5501,13 @@
55015501
"TableCellOnDoubleClickCellCurrentValue": "Current Value:"
55025502
},
55035503
"BootstrapBlazor.Shared.Samples.Table.TablesLookup": {
5504-
"Title": "Table Lookup",
5505-
"Desc": "Used to automatically convert foreign key columns to <code>Text</code> display text",
5506-
"LookupTitle": "Lookup external data source",
5507-
"LookupIntro": "Auto-translate display text by setting <code>Lookup</code>",
5508-
"LookupP1": "In this example, by setting the <code>Lookup</code> value of the <code>Complete</code> column to the value",
5509-
"LookupP2": "The component automatically converts <code>Complete</code> to a preset in the <code>DataSource</code> collection",
5510-
"LookupP3": "In this example, the <code>ILookupService</code> service is used for unified processing, and the <code>Lookup</code> data collection is obtained from the service by setting the <code>LookupServiceKey</code> value"
5504+
"TablesLookupTitle": "Table Lookup",
5505+
"TablesLookupDescription": "Used to automatically convert foreign key columns to <code>Text</code> display text",
5506+
"TableLookupNormalTitle": "Lookup external data source",
5507+
"TableLookupNormalIntro": "Auto-translate display text by setting <code>Lookup</code>",
5508+
"TableLookupNormalTips1": "In this example, by setting the <code>Lookup</code> value of the <code>Complete</code> column to the value",
5509+
"TableLookupNormalTips2": "The component automatically converts <code>Complete</code> to a preset in the <code>DataSource</code> collection",
5510+
"TableLookupNormalTips3": "In this example, the <code>ILookupService</code> service is used for unified processing, and the <code>Lookup</code> data collection is obtained from the service by setting the <code>LookupServiceKey</code> value"
55115511
},
55125512
"BootstrapBlazor.Shared.Samples.Table.TablesRow": {
55135513
"Title": "Table Row",

src/BootstrapBlazor.Shared/Locales/zh.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5516,13 +5516,13 @@
55165516
"TableCellOnDoubleClickCellCurrentValue": "当前值:"
55175517
},
55185518
"BootstrapBlazor.Shared.Samples.Table.TablesLookup": {
5519-
"Title": "Table 表格",
5520-
"Desc": "用于自动将外键列转换成 <code>Text</code> 显示文字",
5521-
"LookupTitle": "Lookup 外置数据源",
5522-
"LookupIntro": "通过设置 <code>Lookup</code> 自动翻译显示文字",
5523-
"LookupP1": "本例中通过设置 <code>Complete</code> 列 <code>Lookup</code> 值为",
5524-
"LookupP2": "组件自动将 <code>Complete</code> 转换为 <code>DataSource</code> 集合中的预设值",
5525-
"LookupP3": "本例中使用 <code>ILookupService</code> 服务进行统一处理,通过设置 <code>LookupServiceKey</code> 值,从服务中获取 <code>Lookup</code> 数据集合"
5519+
"TablesLookupTitle": "Table 表格",
5520+
"TablesLookupDescription": "用于自动将外键列转换成 <code>Text</code> 显示文字",
5521+
"TableLookupNormalTitle": "Lookup 外置数据源",
5522+
"TableLookupNormalIntro": "通过设置 <code>Lookup</code> 自动翻译显示文字",
5523+
"TableLookupNormalTips1": "本例中通过设置 <code>Complete</code> 列 <code>Lookup</code> 值为",
5524+
"TableLookupNormalTips2": "组件自动将 <code>Complete</code> 转换为 <code>DataSource</code> 集合中的预设值",
5525+
"TableLookupNormalTips3": "本例中使用 <code>ILookupService</code> 服务进行统一处理,通过设置 <code>LookupServiceKey</code> 值,从服务中获取 <code>Lookup</code> 数据集合"
55265526
},
55275527
"BootstrapBlazor.Shared.Samples.Table.TablesRow": {
55285528
"Title": "Table 表格",
Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,18 @@
11
@page "/tables/lookup"
2+
@inject IStringLocalizer<Foo> Localizer
3+
@inject IStringLocalizer<TablesLookup> LookupLocalizer
24

3-
<h3>@LookupLocalizer["Title"]</h3>
5+
<h3>@LookupLocalizer["TablesLookupTitle"]</h3>
46

5-
<h4>@((MarkupString)LookupLocalizer["Desc"].Value)</h4>
7+
<h4>@((MarkupString)LookupLocalizer["TablesLookupDescription"].Value)</h4>
68

7-
<DemoBlock Title="@LookupLocalizer["LookupTitle"]" Introduction="@LookupLocalizer["LookupIntro"]" Name="Lookup">
8-
<p>@((MarkupString)LookupLocalizer["LookupP1"].Value)</p>
9+
<DemoBlock Title="@LookupLocalizer["TableLookupNormalTitle"]" Introduction="@LookupLocalizer["TableLookupNormalIntro"]" Name="Lookup" Demo="typeof(Demos.Table.Lookup.TableLookupNormal)">
10+
<p>@((MarkupString)LookupLocalizer["TableLookupNormalTips1"].Value)</p>
911
<Pre>DataSource = new List&lt;SelectedItem&gt;
1012
{
1113
new SelectedItem { Value = "True", Text = @Localizer["True"].Value },
1214
new SelectedItem { Value = "False", Text = @Localizer["False"].Value }
1315
};</Pre>
14-
<p>@((MarkupString)LookupLocalizer["LookupP2"].Value)</p>
15-
<p>@((MarkupString)LookupLocalizer["LookupP3"].Value)</p>
16-
@if (Items != null)
17-
{
18-
<Table TItem="Foo" Items="@Items.Take(3)">
19-
<TableColumns>
20-
<TableColumn @bind-Field="@context.DateTime" Width="180" />
21-
<TableColumn @bind-Field="@context.Name" />
22-
<TableColumn @bind-Field="@context.Complete" LookupServiceKey="Foo.Complete" />
23-
</TableColumns>
24-
</Table>
25-
}
16+
<p>@((MarkupString)LookupLocalizer["TableLookupNormalTips2"].Value)</p>
17+
<p>@((MarkupString)LookupLocalizer["TableLookupNormalTips3"].Value)</p>
2618
</DemoBlock>

src/BootstrapBlazor.Shared/Samples/Table/TablesLookup.razor.cs

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)