Skip to content

Commit

Permalink
fix(Table): not callback SelectedRow when query data (#4072)
Browse files Browse the repository at this point in the history
* fix: 修复 ResetSelectedRows 未回调问题

* refactor: 精简代码逻辑

* chore: bump version 8.8.3-beta04

* refactor: 增加回调

* Revert "fix: 修复 ResetSelectedRows 未回调问题"

This reverts commit f1484a5.

* Revert "refactor: 精简代码逻辑"

This reverts commit b46d42c.

* refactor: 撤销代码

* doc: 更新注释文档

* fix: 增加 SelectedRows 回调方法

Co-authored-by: AiZhen <[email protected]>
  • Loading branch information
ArgoZhang and AiYuZhen authored Aug 15, 2024
1 parent acac1b9 commit 2764b1d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/BootstrapBlazor/BootstrapBlazor.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<Version>8.8.3-beta03</Version>
<Version>8.8.3-beta04</Version>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">
Expand Down
6 changes: 6 additions & 0 deletions src/BootstrapBlazor/Components/Table/Table.razor.Edit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,12 @@ protected async Task QueryData()
ResetSelectedRows(Items);
RowsCache = null;
}

// 更新 SelectedRow 状态
if (SelectedRowsChanged.HasDelegate)
{
await SelectedRowsChanged.InvokeAsync(SelectedRows);
}
return;

async Task OnQuery(QueryPageOptions queryOption)
Expand Down
3 changes: 2 additions & 1 deletion src/BootstrapBlazor/Components/Table/Table.razor.Toolbar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,9 @@ public Func<TItem, bool>? ShowDeleteButtonCallback
public RenderFragment? TableExtensionToolbarTemplate { get; set; }

/// <summary>
/// 获得/设置 新建按钮回调方法
/// 获得/设置 新建按钮回调方法 用于补充模型字段值
/// </summary>
/// <remarks>有些场景下新建模型有些属性字段默认值需要更改为默认业务值,或者该属性数据库中设置不可为空,新建模型默认值为空时,可通过此回调进行属性值补充更新</remarks>
[Parameter]
public Func<Task<TItem>>? OnAddAsync { get; set; }

Expand Down

0 comments on commit 2764b1d

Please sign in to comment.