Browse Source

Disabled actions button if there is no action

pull/20208/head
liangshiwei 2 years ago
parent
commit
749b8e7f6a
  1. 2
      framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor
  2. 5
      framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor.cs

2
framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor

@ -2,7 +2,7 @@
<CascadingValue Value="this" IsFixed="true">
@if ( Type == ActionType.Dropdown )
{
<Dropdown Disabled=@Disabled>
<Dropdown Disabled="@DisabledOrNoActions()">
@if ( HasPrimaryAction )
{
<Button Block="true"

5
framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor.cs

@ -42,6 +42,11 @@ public partial class EntityActions<TItem> : ComponentBase
{
Actions.Add(action);
}
private bool DisabledOrNoActions()
{
return Disabled || !Actions.Any(t => t is { Visible: true, HasPermission: true });
}
protected override void OnInitialized()
{

Loading…
Cancel
Save