I am using the Table Component of Ant Design v2.x and I cannot upgrade. I would like to change the formatting of numbers in row-edit mode, since currently it is inconsistent: In Display mode I have German formatting (as desired), but once I click edit
, numbers are formatted with American decimal separators:
I understand that the table-component encapsulates an Input-Number component which has the parameter decimalSeparator
which I have to adjust. It is not at all obvious to me how I can pass-through that parameter from my parent (table) component column property to the underlying input-number component.
As minimal code base to demonstrate that, let us consider the Typescript example code from https://ant.design/components/table/#components-table-demo-edit-row and focus on the column age
. Assume that it is not an age
, but rather a Value (e.g. of a trade).
The (correct) formatting in the 2nd row of my screenshot I obtain with a render
-function like this:
x.toLocaleString("de-DE", { style: 'currency', currency: ccy, currencyDisplay: "code", maximumFractionDigits: 2 });
where x
is the value to be formatted and ccy
is the currency-string to be displayed, in the screenshot it was just empty.
What I am able to do is to specify whether a column is a number
, a string
, or something else. In the example source code, the corresponding part is:
interface Item {
key: string;
name: string;
age: number;
address: string;
}
Looking forward to your help!