Completed
Last Updated: 19 Jul 2022 13:52 by ADMIN
Release 3.5.0
App
Created on: 15 Jul 2022 16:20
Category: NumericTextBox
Type: Bug Report
1
Cached debounce causes the component to cache its value, which does not get cleared with a new value parameter

===ADMIN EDIT===

In the meantime, a possible workaround is to set the "DebounceDelay" parameter to "0".

================

I use 2 different numeric Text Boxes (one for the cost of a product and another for the tax):

The expected behavior that I am trying to get is:

    - If I type a cost and leave the field (OnBlur event) then it calculates automatically 5% and set the value for the tax

    - However, I want also to allow users to go to the Tax textbox and type a different value (zero for instance)

If I just keep typing different costs the Tax is always calculated and bound correctly as expected:

However, if I go directly to the Tax textbox and type any value there, then this value is always used as a cached value, even if type a new cost and recalculated it:

Eg. Let's say that I typed 10.00 in the tax:

Then if I go to the cost and type 25.00 we would expect that the tax bound variable is 1.25. This is correct while the control still has the focus:

But as soon as I leave the field then the value is reverted back to 10.00:

This is the code that I have:

<div class="form-group col-4">
      <label for="prodCost">Cost</label>
      <TelerikNumericTextBox Id="prodCost" Arrows="false" T="decimal" Decimals="2" Format="C" Min="0.00m" @bind-Value="@product.Cost" OnBlur="BlurCost" ></TelerikNumericTextBox>                                                       
</div>     
                        
<div class="form-group col-4">
      <label for="prodTax">Tax</label>
      <TelerikNumericTextBox  Id="prodTax" Arrows="false" T="decimal" Decimals="2" Format="C" Min="0.00m" @bind-Value="@product.Tax"></TelerikNumericTextBox>                                                                                   
</div>

private void BlurCost()
 {   
     var newTax = product.Cost * (decimal)0.05;
     product.Tax = newTax;               
 }

 

0 comments