File tree Expand file tree Collapse file tree 6 files changed +33
-4
lines changed
BootstrapBlazor.Server/Components/Samples Expand file tree Collapse file tree 6 files changed +33
-4
lines changed Original file line number Diff line number Diff line change 187187 Introduction =" @Localizer[" SortableListTableIntro " ]"
188188 Name =" Table" >
189189 <SortableList Option =" _optionTable" OnUpdate =" OnUpdateTable" >
190- <Table TItem =" Foo" Items =" @Items" IsStriped =" true" ShowLineNo =" true" >
190+ <Table TItem =" Foo" Items =" @Items" IsStriped =" true" ShowLineNo =" true" RenderMode = " TableRenderMode.Table " >
191191 <TableColumns >
192192 <TableColumn @bind-Field =" @context.DateTime" Width =" 180" />
193193 <TableColumn @bind-Field =" @context.Name" />
Original file line number Diff line number Diff line change 11<Project Sdk =" Microsoft.NET.Sdk.Razor" >
22
33 <PropertyGroup >
4- <Version >9.9.1-beta03 </Version >
4+ <Version >9.9.1-beta04 </Version >
55 </PropertyGroup >
66
77 <ItemGroup >
Original file line number Diff line number Diff line change 1+ // Licensed to the .NET Foundation under one or more agreements.
2+ // The .NET Foundation licenses this file to you under the Apache 2.0 License
3+ // See the LICENSE file in the project root for more information.
4+ // Maintainer: Argo Zhang([email protected] ) Website: https://www.blazor.zone 5+
6+ namespace BootstrapBlazor . Components ;
7+
8+ /// <summary>
9+ /// SortableList 组件接口
10+ /// </summary>
11+ public interface ISortableList
12+ {
13+
14+ }
Original file line number Diff line number Diff line change 243243 }
244244 else
245245 {
246- <DynamicElement class =" @GetRowClassString(item, " table-row " )" @key =" item"
246+ <DynamicElement class =" @GetRowClassString(item, " table-row " )" @key =" GetKeyByITem( item) "
247247 TriggerContextMenu =" ContextMenuZone != null" OnContextMenu =" e => OnContextMenu(e, item)"
248248 @ontouchstart =" e => OnTouchStart(e, item)"
249249 @ontouchend =" OnTouchEnd"
692692 < / thead > ;
693693
694694 RenderFragment <TItem > RenderRow => item =>
695- @< DynamicElement TagName = " tr" class = " @GetRowClassString(item)" @key = " item"
695+ @< DynamicElement TagName = " tr" class = " @GetRowClassString(item)" @key = " GetKeyByITem( item) "
696696 TriggerContextMenu = " ContextMenuZone != null" OnContextMenu = " e => OnContextMenu(e, item)"
697697 @ontouchstart = " e => OnTouchStart(e, item)" @ontouchend = " OnTouchEnd"
698698 TriggerClick = " @(ClickToSelect || OnClickRowCallback != null)" OnClick = " () => ClickRow(item)"
Original file line number Diff line number Diff line change @@ -198,6 +198,12 @@ private string GetSortTooltip(ITableColumn col) => SortName != col.GetFieldName(
198198 [ Parameter ]
199199 public bool ShowColumnWidthTooltip { get ; set ; }
200200
201+ ///// <summary>
202+ ///// 获得/设置 行 Key 回调方法
203+ ///// </summary>
204+ //[Parameter]
205+ //public Func<TItem, object?>? OnGetRowKey { get; set; }
206+
201207 private string ScrollWidthString => $ "width: { ActualScrollWidth } px;";
202208
203209 private string ? GetScrollStyleString ( bool condition ) => condition
@@ -780,6 +786,9 @@ public async Task ExpandDetailRow(TItem item)
780786 [ CascadingParameter ]
781787 private ContextMenuZone ? ContextMenuZone { get ; set ; }
782788
789+ [ CascadingParameter ]
790+ private ISortableList ? SortableList { get ; set ; }
791+
783792 [ Inject ]
784793 [ NotNull ]
785794 private IIconTheme ? IconTheme { get ; set ; }
@@ -1681,6 +1690,8 @@ private void OnTouchEnd()
16811690 TouchStart = false ;
16821691 }
16831692
1693+ private object ? GetKeyByITem ( TItem item ) => SortableList != null ? item : null ; //OnGetRowKey?.Invoke(item);
1694+
16841695 /// <summary>
16851696 /// Dispose 方法
16861697 /// </summary>
Original file line number Diff line number Diff line change @@ -963,3 +963,7 @@ form .table .table-cell > textarea {
963963 border-bottom-color : var (--bs-primary );
964964 }
965965}
966+
967+ .bb-sortable tr {
968+ cursor : pointer ;
969+ }
You can’t perform that action at this time.
0 commit comments