Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On CRUD Form numeric field (with format #,##0.00) when updated becomes zero 0 [Label: bug & feature] #296

Closed
borisdj opened this issue Jun 28, 2021 · 2 comments

Comments

@borisdj
Copy link
Contributor

borisdj commented Jun 28, 2021

Describe the bug
Numeric field with thousands separator when updated gets 0.00 value instead of actual.

To Reproduce
Steps to reproduce the behavior:
IN CODE - Set Format:
c.Add(o => o.Amount).Format("{0:#,##0.00}");

ON FORM

  1. Add ___________________ image

  2. Added ________________ image

**

  1. Update _______________ image

  2. Updated ______________ image

Expected behavior
After update Amount should be 1,234.57.
Currently only way for getting correct value is when editing number with 4+ digits to always delete thousands separators in the field and then Save the Form.

Fix should parse correctly separator to number, or not to be shown in the field at all.
Also to note that when using localization de-DE and some other European languages, comma and dot are inverted:
1.234,56
But bug is the same, also goes to zero.

Additionaly it would be best if Field could be configured in such way that thousands separator is shown both when Adding or Updating on FocusOut when switching input to another field. In that case when that number is in Focus then thousands separator is removed in both cases since it can interfere with typing digits. This format is useful to avoid mistakes when typing large numbers.

  • In Focus
    image
  • Out Focus
    image
@borisdj borisdj changed the title On CRUD Form numeric field (with format #,###.00) when updated becomes zero 0 On CRUD Form numeric field (with format #,##0.00) when updated becomes zero 0 Jun 28, 2021
@borisdj borisdj changed the title On CRUD Form numeric field (with format #,##0.00) when updated becomes zero 0 On CRUD Form numeric field (with format #,##0.00) when updated becomes zero 0 [Label: bug & feature] Jun 28, 2021
@gustavnavar
Copy link
Owner

Package 2.1.18 implements your fix.

This sample implements it for the Freight field: https://gridblazor.azurewebsites.net/crud

Thanks for your fix

@borisdj
Copy link
Contributor Author

borisdj commented Jul 16, 2021

Glad to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants