Closed isglass closed 4 years ago
When cell editing is used, it seems like passing the NumberColumn
's format
on to the NumberField
would be appropriate. I have done so on my PR (https://github.com/bryntum/bryntum-suite/pull/364). There is a test failure but I think the resolution would be a change to the test as well as the underlying widget.
The NumberColumn
now has a format
config which defaults to the locale's default format. This format
can be specified as a template string (such as 9,9.99##
to enable thousand separators, minimum of 2 decimal digits and max of 4). It can also be a config object for the NumberFormat
class.
This config is passed to the NumberField
when cell editing is active.
The NumberFormat
class supports the same options as Intl.NumberFormat
but also provides a parse()
method that uses the proper decimal and digit grouping character.
The framework needs a general purpose number formatting function which can be internationalized. Probably in
Core/helper/StringHelper
. Should use browser formatting https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat. Locale can be read from same setting as DateHelper uses (key DateHelper.locale in localization files)Probably needs a string-based format token for ease of use.
NumberColumn should then use it in its
defaultRenderer
.Right now, any non-integer value can be displayed by javascript's default toString which is unsuitable for a UI.
Transfered from Assembla #6246.