I am using Radzen Numeric with a nullable decimal. The default should be null. Worked well until I installed 4.12.1. When I now tab out, the value changes to the minimum rather than staying on the default. The change event is not firing, it just displaying the min value after you tab out.
<RadzenNumeric TValue="decimal?" ShowUpDown="false" TextAlign="TextAlign.Center" Min="10" Max="50" @bind-Value="@myValue" />
I can also reproduce the issue in the Radzen demos with the following:
<div class="rz-p-12 rz-text-align-center">
<RadzenNumeric ShowUpDown="false" TValue="int?" Min=1 Max=100 @bind-Value=@value Placeholder="Enter or clear value" />
</div>
@code{
int? value;
}
It appears to be a potential bug.
enchev
June 13, 2023, 5:56am
3
Hi @mrentier ,
This is definitely a bug and will be fixed immediately!
1 Like
4.15.2 and higher seem to have a regression on this. Following is based upon the Radzen demo and reproduces it:
<div class="rz-p-12 rz-text-align-center">
<div>@value</div>
<RadzenNumeric Min="1" Max="10" TValue="int?" @bind-Value=@value Change=@(_=>StateHasChanged()) />
</div>
@code{
int? value;
}
@enchev : did this bug show up again?
enchev
August 18, 2023, 5:45am
6
It seems that the issue was not fixed completely with my previous commit - it will be fixed in our update later today.
1 Like
@enchev starting with 4.23.7 this issue showed up again. I have verified that 4.23.6 functions correctly.
enchev
January 13, 2024, 6:51am
8
Most probably caused by this:
radzenhq:master
← pianomanjh:feature/numeric-support-for-iformattable
opened 08:54PM - 10 Jan 24 UTC
- As a follow-up to PR #1315 , to add support for `IFormattable`, for scenarios … where custom numeric types would like to handle their own formatting.
- Adjusts the code in `SetParametersAsync` to also support custom numeric types, and provides a fast path to avoid conversion if the value to be set is already of the correct type.
- Provides demo examples of using custom numeric types with `RadzenNumeric`.
I will check it and we will release update Monday.
enchev
January 14, 2024, 7:26am
9
I just tested your code in our latest demos however I was unable to reproduce it:
tried both nullable int and decimal:
<div class="rz-p-12 rz-text-align-center">
<RadzenNumeric Min="1" Max="10" TValue="int?" @bind-Value=@value />
</div>
@code{
int? value;
}
Enter a value, for example 5 and tab out. Then clear the box and tab out. A value of 1 is displayed. You should be able to clear an input box with a nullable value even when min/max have been set for when a value is provided. If you want to require a value, then you can use a non-nullable type.
enchev
January 26, 2024, 9:15am
11
There is a test now to make sure that it will not happen again:
committed 09:09AM - 26 Jan 24 UTC
1 Like