diff --git a/src/BootstrapBlazor.Shared/Pages/Samples/Table/TablesColumn.razor b/src/BootstrapBlazor.Shared/Pages/Samples/Table/TablesColumn.razor index 450a3b756eae1819ae467f6257a07fad510970e7..edf3ba083cccb4a7e3ca3d6143e630c4cddde1e9 100644 --- a/src/BootstrapBlazor.Shared/Pages/Samples/Table/TablesColumn.razor +++ b/src/BootstrapBlazor.Shared/Pages/Samples/Table/TablesColumn.razor @@ -53,7 +53,7 @@

本例中继续上一个例子,实现了自定义四个功能按钮,并且扩展到行内,点击各个按钮时均有相对应的回调委托方法,TableToolbarButton 采用的是 Delegate 方式完成数据交换,点击工具栏按钮时设置 OnClickCallback 委托方法即可获取表内选中的行数据集合

- SelectedRows { get; set; } = new(); + + [NotNull] + private Table? TableRows { get; set; } /// /// /// @@ -125,6 +129,10 @@ namespace BootstrapBlazor.Shared.Pages.Table Title = title, Content = content }); + + SelectedRows.Clear(); + SelectedRows.Add(item); + await TableRows.QueryAsync(); } } } diff --git a/src/BootstrapBlazor/Components/Table/Table.razor b/src/BootstrapBlazor/Components/Table/Table.razor index ccd85fd2949b8a42863978251190999c02f718bc..54505a5be9389db8ca8f75c0d101b077e901a86b 100644 --- a/src/BootstrapBlazor/Components/Table/Table.razor +++ b/src/BootstrapBlazor/Components/Table/Table.razor @@ -167,7 +167,6 @@ } else { - StarRowIndex = (PageIndex - 1) * PageItems + 1; foreach (var item in Items) { - @(StarRowIndex++) + @(Items.ToList().IndexOf(item) + 1 + (PageIndex -1) * PageItems) } @foreach (var col in Columns) diff --git a/src/BootstrapBlazor/Components/Table/Table.razor.cs b/src/BootstrapBlazor/Components/Table/Table.razor.cs index 39cf4426c5a55f3343307857c25e52af32f5f222..dd6f81e0eba2e3d9242412db658f25b2c85717b5 100644 --- a/src/BootstrapBlazor/Components/Table/Table.razor.cs +++ b/src/BootstrapBlazor/Components/Table/Table.razor.cs @@ -313,11 +313,6 @@ namespace BootstrapBlazor.Components /// protected IEnumerable? FilterColumns { get; set; } - /// - /// 获得 起始行号 - /// - protected int StarRowIndex { get; set; } - /// /// 获得/设置 组件是否渲染完毕 默认 false /// diff --git a/src/BootstrapBlazor/Components/Table/TableCellButton.cs b/src/BootstrapBlazor/Components/Table/TableCellButton.cs index 06fe6abafe9dc5474bbc178d1b4e5c733e5f8221..1e2d759ca7586fb814ea19f519fcd0e262ae0e0b 100644 --- a/src/BootstrapBlazor/Components/Table/TableCellButton.cs +++ b/src/BootstrapBlazor/Components/Table/TableCellButton.cs @@ -41,15 +41,33 @@ namespace BootstrapBlazor.Components if (Size == Size.None) Size = Size.ExtraSmall; - var onClick = OnClick; - OnClick = EventCallback.Factory.Create(this, async e => + OnClickButton = EventCallback.Factory.Create(this, async e => { - if (!IsDisabled) + if (IsAsync) { - if (onClick.HasDelegate) await onClick.InvokeAsync(e); - - if (Item != null && OnClickCallback != null) await OnClickCallback.Invoke(Item); - if (Item != null && OnClickWithoutRenderCallback != null) await OnClickWithoutRenderCallback.Invoke(Item); + ButtonIcon = LoadingIcon; + IsDisabled = true; + } + if (OnClickWithoutRender != null) + { + await OnClickWithoutRender.Invoke(); + } + if (OnClick.HasDelegate) + { + await OnClick.InvokeAsync(e); + } + if (Item != null && OnClickWithoutRenderCallback != null) + { + await OnClickWithoutRenderCallback.Invoke(Item); + } + if (Item != null && OnClickCallback != null) + { + await OnClickCallback.Invoke(Item); + } + if (IsAsync) + { + ButtonIcon = Icon; + IsDisabled = false; } }); }