ProgressNS / nativescript-ui-feedback

This repository is used for customer feedback regarding Telerik UI for NativeScript. The issues system here is used by customers who want to submit their feature requests or vote for existing ones.
Other
115 stars 21 forks source link

RadDataForm Decimal editor doesn't allow to input negative value #1439

Open bhcuong2008 opened 4 years ago

bhcuong2008 commented 4 years ago

Please take a minute to read our NativeScript Code of Conduct before proceeding with posting issues or discussing. The purpose of this guide is to make communication and cooperation within our forums a pleasure for you and the other members.

Please, provide the details below:

Tell us about the problem

RadDataForm Decimal editor doesn't allow negative value

Which platform(s) does your issue occur on?

Android API 21, 27, 28. iOS not tested

Please provide the following version numbers that your issue occurs with:

Please tell us how to recreate the issue in as much detail as possible.

  1. Create a source object with a property of type number
  2. Create dataform with above source, specify that field as Decimal editor type.
  3. Then run app, only input positive float number inside that editor.

Or run samples at https://github.com/ProgressNS/nativescript-ui-samples

Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.

(You can paste entire code snippets, link to playground demo or attach a runnable project)

bhcuong2008 commented 4 years ago

inside source of TNSDataForm-release.aar, I found that it's limited by this in file DataFormDecimalEditor.class:

protected void initEditor(View editor, EntityProperty property) {
        super.initEditor(editor, property);
        this.decimalSeparator = DecimalFormatSymbols.getInstance(Locale.getDefault()).getDecimalSeparator();
        this.numberFormat = NumberFormat.getInstance();
        this.numberFormat.setMaximumFractionDigits(127);
        EditText coreEditor = (EditText)editor;
        coreEditor.setInputType(12290);
=>   coreEditor.setKeyListener(DigitsKeyListener.getInstance("0123456789" + this.decimalSeparator));
}

I think this is the reason Decimal editor does not accept key '-' for negative number.