File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
src/BootstrapBlazor.Server/Components/Samples/Table Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 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" FormatString = " 0.00 " />
168+ <TableColumn @bind-Field =" @context.Count" Formatter = " @IntFormatter " />
169169 </TableColumns >
170170 </Table >
171171</DemoBlock >
Original file line number Diff line number Diff line change @@ -36,6 +36,22 @@ 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 = $ "Sales: { val : 0.00} ";
51+ }
52+ return Task . FromResult ( ret ) ;
53+ }
54+
3955 private Task < QueryData < Foo > > OnQueryAsync ( QueryPageOptions options )
4056 {
4157 IEnumerable < Foo > items = Items ;
You can’t perform that action at this time.
0 commit comments