Author Topic: Option to display and(!) enter numeric values with SI unit prefixes  (Read 88 times)

Jens

  • Newbie
  • *
  • Posts: 4
    • View Profile
I wonder if it is possible to make Paramquery (Pro) display, and also allow entering, of SI unit prefixes and powers of 10 in certain cells?
See https://en.wikipedia.org/wiki/Unit_prefix
This way, I can enter "520k" and it will be displayed as "520k" but the underlying data will have 520000. Or 1.4G (=1400000000), "0.9u" (=0.0000009), etc.
If I enter "520000" it will be automatically reformatted as "520k" but saved as 520000 (pure numeric value).
And if I enter "0.9e-3" or "1.78e10" it will be parsed as "0.0009" and "178000000" respectively.

This would make entering numeric values much much easier, especially for scientific data.
The system should accept SI and exponential entry, but be configurable to display only in one format, so the display is always consistent.
(Note that SI prefixes are case sensitive, "m" and "M" are different; but the "e" for powers of 10 (Exponent) is not. "E" is also possible.

Currently, for cells that are defined to only accept numeric data, this is not possible; non-numeric characters are filtered.

paramquery

  • Administrator
  • Hero Member
  • *****
  • Posts: 3659
    • View Profile
Re: Option to display and(!) enter numeric values with SI unit prefixes
« Reply #1 on: October 15, 2018, 11:09:55 am »
This is possible by using.

1) column.format function to format numbers to SI format.

2) column.deFormat to enable range filtering of such data.

3) Disable numeric filtering in fields by setting option: filterModel.filterKeys.

4) column.editor.getData to convert SI units to numbers. column.deFormat can be reused here.

Jens

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Option to display and(!) enter numeric values with SI unit prefixes
« Reply #2 on: October 16, 2018, 12:08:30 pm »
Thank you!
We will try it this way.

Do you have any code examples to put into a jsfiddle (etc) to get started?