diff --git a/src/components/FormField/components/CriteriaTable/RenderTable/components/NumericFormulaCell/index.js b/src/components/FormField/components/CriteriaTable/RenderTable/components/NumericFormulaCell/index.js index 7ededbe..f7656e9 100644 --- a/src/components/FormField/components/CriteriaTable/RenderTable/components/NumericFormulaCell/index.js +++ b/src/components/FormField/components/CriteriaTable/RenderTable/components/NumericFormulaCell/index.js @@ -8,7 +8,11 @@ const NumericFormulaCell = ({ getValue, row: { index }, column: { id }, table }) e.target.select(); } - const onChange = (value) => { + /*const onChange = (value) => { + table.options.meta?.updateData(index, id, value); + };*/ + + const onBlur = (value) => { table.options.meta?.updateData(index, id, value); }; @@ -16,8 +20,9 @@ const NumericFormulaCell = ({ getValue, row: { index }, column: { id }, table }) onChange(e.value)} + /*onValueChange={(e) => onChange(e.value)}*/ onFocus={onFocus} + onBlur={(e) => onBlur(e.target.value)} minFractionDigits={0} maxFractionDigits={2} locale='it-IT' diff --git a/src/components/FormField/components/Table/RenderTable/components/NumericFormulaCell/index.js b/src/components/FormField/components/Table/RenderTable/components/NumericFormulaCell/index.js index 7ededbe..4256294 100644 --- a/src/components/FormField/components/Table/RenderTable/components/NumericFormulaCell/index.js +++ b/src/components/FormField/components/Table/RenderTable/components/NumericFormulaCell/index.js @@ -8,7 +8,12 @@ const NumericFormulaCell = ({ getValue, row: { index }, column: { id }, table }) e.target.select(); } - const onChange = (value) => { + /*const onChange = (value) => { + console.log('table.options.meta', table.options.meta) + table.options.meta?.updateData(index, id, value); + };*/ + + const onBlur = (value) => { table.options.meta?.updateData(index, id, value); }; @@ -16,8 +21,9 @@ const NumericFormulaCell = ({ getValue, row: { index }, column: { id }, table }) onChange(e.value)} + /*onValueChange={(e) => onChange(e.value)}*/ onFocus={onFocus} + onBlur={(e) => onBlur(e.target.value)} minFractionDigits={0} maxFractionDigits={2} locale='it-IT' diff --git a/src/components/FormField/components/Table/index.js b/src/components/FormField/components/Table/index.js index 8edd2d7..0edcb06 100644 --- a/src/components/FormField/components/Table/index.js +++ b/src/components/FormField/components/Table/index.js @@ -122,13 +122,8 @@ const Table = ({ useEffect(() => { const stateFieldData = pathOr([], ['stateFieldData'], tableColumns); - /*const obj = stateFieldData - .reduce((acc, cur) => { - acc[cur.name] = '' - return acc; - }, {});*/ let rowsData = pathOr([], ['rowsData'], tableColumns); - //rowsData = isEmpty(rowsData) ? [obj] : rowsData; + setColumnsCfg(stateFieldData); setRowsCfg(rowsData);