From 8042d5f135f495c0423aeac6aca8c47d1513623a Mon Sep 17 00:00:00 2001 From: Argo-Cloud Date: Thu, 1 Apr 2021 11:44:34 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=B0=8F=E5=B1=8F?= =?UTF-8?q?=E5=B9=95=E4=B8=8B=E8=A1=8C=E5=8F=B7=E4=B8=8D=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/Table/Table.razor | 3 +-- src/BootstrapBlazor/Components/Table/Table.razor.cs | 5 ----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/BootstrapBlazor/Components/Table/Table.razor b/src/BootstrapBlazor/Components/Table/Table.razor index ccd85fd29..54505a5be 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 39cf4426c..dd6f81e0e 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 /// -- Gitee From e442546bf171bcb921525341de28392112959871 Mon Sep 17 00:00:00 2001 From: Argo-Cloud Date: Thu, 1 Apr 2021 12:01:32 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=E8=A1=8C=E5=86=85=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E6=94=AF=E6=8C=81=E8=AE=BE=E7=BD=AE=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E8=A1=8C=E9=80=89=E4=B8=AD=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Table/TableCellButton.cs | 32 +++++++++++++++---- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/src/BootstrapBlazor/Components/Table/TableCellButton.cs b/src/BootstrapBlazor/Components/Table/TableCellButton.cs index 06fe6abaf..1e2d759ca 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; } }); } -- Gitee From b98ca408047815954f97c2a64cc9789f19ce65f6 Mon Sep 17 00:00:00 2001 From: Argo-Cloud Date: Thu, 1 Apr 2021 12:01:53 +0800 Subject: [PATCH 3/3] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0=E8=A1=8C?= =?UTF-8?q?=E5=86=85=E6=8C=89=E9=92=AE=E6=93=8D=E4=BD=9C=E5=90=8E=E9=80=89?= =?UTF-8?q?=E4=B8=AD=E5=BD=93=E5=89=8D=E8=A1=8C=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pages/Samples/Table/TablesColumn.razor | 2 +- .../Pages/Samples/Table/TablesColumn.razor.cs | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/BootstrapBlazor.Shared/Pages/Samples/Table/TablesColumn.razor b/src/BootstrapBlazor.Shared/Pages/Samples/Table/TablesColumn.razor index 450a3b756..edf3ba083 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(); } } } -- Gitee