diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor
index 99e0383fdc..0a6cc9b8b9 100644
--- a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor
+++ b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor
@@ -12,10 +12,10 @@ else
{
if (IsVisible)
{
-
+
+
}
}
diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor
index d445d102d3..bdce83b13a 100644
--- a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor
+++ b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor
@@ -1,15 +1,15 @@
@typeparam TItem
-
- @if (Type == ActionType.Dropdown)
+
+ @if ( Type == ActionType.Dropdown )
{
- @if (HasPrimaryAction)
+ @if ( HasPrimaryAction )
{
-
+
+
}
else
diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor.cs
index e1ee4dacdf..4b9137bcfb 100644
--- a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor.cs
+++ b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
+using System.Threading.Tasks;
using Blazorise;
using Localization.Resources.AbpUi;
using Microsoft.AspNetCore.Components;
@@ -12,7 +13,6 @@ namespace Volo.Abp.BlazoriseUI.Components
protected readonly List> Actions = new List>();
protected bool HasPrimaryAction => Actions.Any(t => t.Primary);
protected EntityAction PrimaryAction => Actions.FirstOrDefault(t => t.Primary);
- protected internal ActionType Type => Actions.Count(t => t.IsVisible) > 1 ? ActionType.Dropdown : ActionType.Button;
[Parameter]
public Color ToggleColor { get; set; } = Color.Primary;
@@ -26,17 +26,18 @@ namespace Volo.Abp.BlazoriseUI.Components
[Parameter]
public DataGridEntityActionsColumn EntityActionsColumn { get; set; }
+ [Parameter]
+ public ActionType Type { get; set; } = ActionType.Dropdown;
+
+ [CascadingParameter]
+ public DataGridEntityActionsColumn ParentEntityActionsColumn { get; set; }
+
[Inject]
public IStringLocalizer UiLocalizer { get; set; }
internal void AddAction(EntityAction action)
{
Actions.Add(action);
- if (EntityActionsColumn != null)
- {
- EntityActionsColumn.Displayable = Actions.Any(t => t.IsVisible);
- }
- InvokeAsync(StateHasChanged);
}
protected override void OnInitialized()
@@ -44,5 +45,20 @@ namespace Volo.Abp.BlazoriseUI.Components
base.OnInitialized();
ToggleText = UiLocalizer["Actions"];
}
+
+ protected override async Task OnAfterRenderAsync(bool firstRender)
+ {
+ if (firstRender)
+ {
+ if (ParentEntityActionsColumn != null)
+ {
+ ParentEntityActionsColumn.Displayable = Actions.Any(t => t.IsVisible);
+ }
+
+ await InvokeAsync(StateHasChanged);
+ }
+
+ await base.OnAfterRenderAsync(firstRender);
+ }
}
}