Hi,
We started development with Infragistics IgniteUI v14.x and are now on v15.2 and we are no longer seeing some functionality previously present in v14 for igCurrencyEditor.
In past versions of the library, igCurrencyEditor would round values to the maxDecimal length and would not allow users to input more than maxDecimals decimal value.For example, in v14.x, if we set maxDecimals = 5, input was limited to that many decimals (ex. x.xxxxx) and would not allow an input of 0.123456789, but programmatically setting the value by calling $element.igCurrencyEditor("value", 0.12345999) would round the value to 0.12346.
We are no longer seeing this in 15.2. Instead, the igCurrencyEditor allows input of any length and simply truncates the value to 0.12345, without rounding.
Was the removal of these features intentional? If so, what was the reasoning behind it?Is there any plan to add this functionality back into the editor?Or, is there a workaround, so we can return to the past functionality?
Thank you.
Thank you for posting in the Infragistics community !
First, let me know that with 15.2 release all Ignite UI editors have been re-architected to optimize their usability. Thus the behavior of the maxDecimals property was changed as per your observations show. This change is by design and is the expected behavior of the new editors suite. If you want to keep the other behavior , you can achieve this using the following workaround, which rounds the value in the valueChanging event:
$("#federalTax").igCurrencyEditor({ listItems: listValues, maxDecimals: 4, value: 600, valueChanging: function (evt, ui) { var pos = ui.owner.options.maxDecimals; num = parseFloat(ui.editorInput.val()); ui.newValue = Math.round(num * Math.pow(10,pos)) / Math.pow(10,pos); ui.owner.value(ui.newValue); }});
Please let me know if you have further questions on the matter, I will be glad to help.
Thank you for your suggested code. However, it seems to round correctly and set the internal value correctly, but the formatted displayed value for the editor never updates to the rounded value.
Based on your own JSFiddle examples, I have created one with the code you suggest. To see it in action, enter 0.12345999 into the textbox, then click out of it. If you open the console, you will see that the actual value for the editor changed to 0.12346, but the displayed value still shows $0.12345. If you edit the textbox again, the edited value will again display 0.12345.
How can we permanently set the underlying value and have the displayed value update correctly?