Piotr
October 12, 2023, 10:28am
1
Hi,
i need to disable RadzenSelectBarItem when in other controls are specific values. In other control i used property Change. This is used in column in gridcontrol.
The method that changes the variable is fired:
And in RadzenSelectBar on RadzenSelectBarItem i have setted: Disabled="@_disabledAcceptanceCalendarDays " />
Unfortunately, it doesn't work very well. I'm uploading a video showing what the problem is: https://youtu.be/KOdncd2O2Ok
am I doing something wrong? thx.
enchev
October 12, 2023, 12:03pm
2
In your first code screenshot Disabled property is bound to @Disabled not to @_disabledAcceptanceCalendarDays, maybe that's the problem.
Piotr
October 12, 2023, 12:25pm
3
Thx but this is other control. This is used to check, that i can choose second value in my first control.
In other control i used property Change.
when I change the value here, it is checked whether I can select the second value in the control that has the problem. In the CalcAcceptance() method
the control where the problem is looks like this:
I removed the Disabled property for testing. Unfortunately there is no improvement. The control still behaves strangely after a few clicks. Now it looks like this:
The problem still occurs as in the video:
Piotr
October 13, 2023, 7:38am
4
I have prepared a simple code that shows what the problem is. Sometimes it works fine. But you may notice that a square stops being active or becomes active only after an action on that square.
New video for this code: https://youtu.be/x1PiPvaVDqQ
@page "/select-bar-test"
<RadzenCard>
<RadzenDataGrid @bind-Data="@Items" TItem="GridItem" class="mt-4 w-100">
<HeaderTemplate>
<div class="row d-flex w-100">
<div class="col-auto p-2 justify-content-end bd-highlight">
<RadzenSelectBar class="bg-white rounded-pill my-auto" TValue="int" Size="ButtonSize.Small" @bind-Value="@SelectedAnimal">
<Items>
<RadzenSelectBarItem Value="1" Text="Cat " Disabled="@_disableCat" />
<RadzenSelectBarItem Value="2" Text="Birds" />
</Items>
</RadzenSelectBar>
</div>
</div>
</HeaderTemplate>
<Columns>
<RadzenDataGridColumn Title="Name" Property="Name" TItem="GridItem" />
<RadzenDataGridColumn Title="Action" TItem="GridItem">
<Template Context="data">
<div class="d-flex justify-content-center">
<RadzenSelectBar class="bg-white rounded-pill my-auto" TValue="int" Size="ButtonSize.Small" @bind-Value="@data.Action" Change="() => CheckHeader()">
<Items>
<RadzenSelectBarItem Value="1" Text="Eats food" />
<RadzenSelectBarItem Value="2" Text="drinks water" />
<RadzenSelectBarItem Value="3" Text="flaps wings" />
</Items>
</RadzenSelectBar>
</div>
</Template>
</RadzenDataGridColumn>
</Columns>
</RadzenDataGrid>
</RadzenCard>
@code {
public List<GridItem> Items { get; private set; }
public int SelectedAnimal { get; private set; }
private const int _flapsWingsAction = 3;
private const int _birdAnimal = 2;
private bool _disableCat;
protected override async Task OnInitializedAsync()
{
Items = new List<GridItem>
{
new() { Name = "Animal Action", Action = 1 },
new() { Name = "Animal Action", Action = 2 }
};
}
private async Task CheckHeader()
{
_disableCat = false;
if (Items.Any(x => x.Action == _flapsWingsAction))
{
_disableCat = true;
SelectedAnimal = _birdAnimal;
}
}
public class GridItem
{
public string Name { get; set; }
public int Action { get; set; }
}
}
enchev
October 13, 2023, 8:49am
5
It will be fixed in our next update early next week:
committed 08:49AM - 13 Oct 23 UTC
1 Like