How can I prevent scientific notation in editor form fields?

How can I prevent scientific notation in editor form fields?

NLambertNLambert Posts: 3Questions: 1Answers: 0

I used render: $.fn.dataTable.render.number(',', '.', 8, '') to fix the datatable display but when I click to edit it shows scientific notation.

Answers

  • allanallan Posts: 63,889Questions: 1Answers: 10,530 Site admin

    Editor will use whatever is in the raw data - not the rendered value. So if the raw data in the JSON feed is in scientific notation, that is what Editor would show. The "fix" is to alter the data source to have it display without scientific notation.

    Worth noting that generally you wouldn't want the formatted number in the Editor input element (e.g. 1,000,000) since you might need to enforce formatting requirements on the end user - e.g. what is 1,00,000 - an error or valid? If you do what that find of formatting, the mask plug-in is a good way of doing this.

    Allan

  • NLambertNLambert Posts: 3Questions: 1Answers: 0

    When I run it without using DataTables using the raw output I don't get scientific notation. So I'm guessing javascript is causing most of it when rendering. I will take a look at the mask plug-in. Just wish sci notation could be disabled completely as I can't imagine anyone ever wants to look at numbers in that format.

    Thanks for the quick reply.

    Nolan

  • NLambertNLambert Posts: 3Questions: 1Answers: 0

    I changed the database end of the fields in question to decimal 18,8. No more sci notation. May not be a fix through code but it is a fix non the less.

This discussion has been closed.