Skip to content

Commit c98db7b

Browse files
committed
doc: 更新示例
1 parent c4de624 commit c98db7b

File tree

4 files changed

+5
-21
lines changed

4 files changed

+5
-21
lines changed

src/BootstrapBlazor.Server/Components/Samples/Table/TablesColumn.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
<TableColumn @bind-Field="@context.DateTime" Width="120" FormatString="yyyy-MM-dd" Align="Alignment.Center" />
147147
<TableColumn @bind-Field="@context.Name" Width="100" />
148148
<TableColumn @bind-Field="@context.Address" />
149-
<TableColumn @bind-Field="@context.Count" Formatter="@IntFormatter" Width="60" Align="Alignment.Right" />
149+
<TableColumn @bind-Field="@context.Count" Width="60" Align="Alignment.Right" />
150150
</TableColumns>
151151
</Table>
152152
</DemoBlock>
@@ -165,7 +165,7 @@
165165
<TableColumn @bind-Field="@context.DateTime" Width="120" FormatString="yyyy-MM-dd" />
166166
<TableColumn @bind-Field="@context.Name" Width="100" />
167167
<TableColumn @bind-Field="@context.Address" />
168-
<TableColumn @bind-Field="@context.Count" Formatter="@IntFormatter" />
168+
<TableColumn @bind-Field="@context.Count" FormatString="0.00" />
169169
</TableColumns>
170170
</Table>
171171
</DemoBlock>

src/BootstrapBlazor.Server/Components/Samples/Table/TablesColumn.razor.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,6 @@ protected override void OnInitialized()
3636

3737
private static bool ShowCheckbox(Foo foo) => foo.Complete;
3838

39-
/// <summary>
40-
/// IntFormatter
41-
/// </summary>
42-
/// <param name="d"></param>
43-
/// <returns></returns>
44-
private static Task<string> IntFormatter(object? d)
45-
{
46-
var ret = "";
47-
if (d is TableColumnContext<Foo, object?> data && data.Value != null)
48-
{
49-
var val = (int)data.Value;
50-
ret = val.ToString("0.00");
51-
}
52-
return Task.FromResult(ret);
53-
}
54-
5539
private Task<QueryData<Foo>> OnQueryAsync(QueryPageOptions options)
5640
{
5741
IEnumerable<Foo> items = Items;

src/BootstrapBlazor.Server/Locales/en-US.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5036,7 +5036,7 @@
50365036
"FormatterTitle": "Custom column data format",
50375037
"FormatterIntro": "Format the cell value by specifying the <code>FormatString</code> or <code>Formatter</code> callback delegate when the column is bound",
50385038
"FormatterP1": "In this example the column <code>DateTime</code> values ​​are formatted according to <code>FormatString</code> to <code>yyyy-MM-dd</code> year month day format",
5039-
"FormatterP2": "In this example the column <code>Count</code> value is formatted according to <code>Formatter</code> to <code>0.00</code> with two decimal places",
5039+
"FormatterP2": "In this example the column <code>Count</code> value is formatted according to <code>FormatString</code> to <code>0.00</code> with two decimal places",
50405040
"AlignTitle": "Column data alignment",
50415041
"AlignIntro": "Set the alignment by specifying the <code>Align</code> attribute when the column is bound",
50425042
"AlignP1": "In this example the column <code>DateTime</code> is set to center alignment <code>Alignment.Center</code>",

src/BootstrapBlazor.Server/Locales/zh-CN.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5034,9 +5034,9 @@
50345034
"DisabledTitle": "选择框列",
50355035
"DisabledIntro": "<code>RowTemplate</code> 内部组件 <code>TableCell</code> 设置 <code>Checkbox</code> 并设置相关数据绑定即可,本示例中通过数据绑定将选择框组件与值进行绑定",
50365036
"FormatterTitle": "自定义列数据格式",
5037-
"FormatterIntro": "列绑定时通过指定 <code>FormatString</code> 或者 <code>Formatter</code> 回调委托来实现单元格数值格式化",
5037+
"FormatterIntro": "列绑定时通过指定 <code>FormatString</code> 实现单元格数值格式化。<b>注意</b> 列属性 <code>Formatter</code> 回调方法不支持,仅当列渲染为 <code>Display<code> 时生效",
50385038
"FormatterP1": "本例中列 <code>DateTime</code> 值根据 <code>FormatString</code> 将值格式化为 <code>yyyy-MM-dd</code> 年月日格式",
5039-
"FormatterP2": "本例中列 <code>Count</code> 值根据 <code>Formatter</code> 将值格式化为 <code>0.00</code> 保留两位小数格式",
5039+
"FormatterP2": "本例中列 <code>Count</code> 值根据 <code>FormatString</code> 将值格式化为 <code>0.00</code> 保留两位小数格式",
50405040
"AlignTitle": "列数据对齐方式",
50415041
"AlignIntro": "列绑定时通过指定 <code>Align</code> 属性设置对齐方式",
50425042
"AlignP1": "本例中列 <code>DateTime</code> 列设置为居中对齐 <code>Alignment.Center</code>",

0 commit comments

Comments
 (0)