- saving progress;
This commit is contained in:
@@ -7,7 +7,7 @@ import { isEmpty } from 'ramda';
|
||||
import DefaultCell from './components/DefaultCell';
|
||||
import LastRowCell from './components/LastRowCell';
|
||||
|
||||
const RenderTable = ({ rowsData, columnsCfg, lastRowCfg, setRowsFn, disabled }) => {
|
||||
const RenderTable = ({ rowsData = [], columnsCfg, lastRowCfg, setRowsFn, disabled }) => {
|
||||
const table = useReactTable({
|
||||
data: rowsData,
|
||||
columns: columnsCfg,
|
||||
|
||||
@@ -122,13 +122,13 @@ const Table = ({
|
||||
|
||||
useEffect(() => {
|
||||
const stateFieldData = pathOr([], ['stateFieldData'], tableColumns);
|
||||
const obj = stateFieldData
|
||||
/*const obj = stateFieldData
|
||||
.reduce((acc, cur) => {
|
||||
acc[cur.name] = ''
|
||||
return acc;
|
||||
}, {});
|
||||
let rowsData = pathOr([obj], ['rowsData'], tableColumns);
|
||||
rowsData = isEmpty(rowsData) ? [obj] : rowsData;
|
||||
}, {});*/
|
||||
let rowsData = pathOr([], ['rowsData'], tableColumns);
|
||||
//rowsData = isEmpty(rowsData) ? [obj] : rowsData;
|
||||
setColumnsCfg(stateFieldData);
|
||||
setRowsCfg(rowsData);
|
||||
|
||||
@@ -169,7 +169,8 @@ const Table = ({
|
||||
{label}{config.required || config.isRequired || (config.validate && config.validate.nonEmptyTables)
|
||||
? <span className="appForm__field--required">*</span> : null}
|
||||
</label>
|
||||
{rows ? <RenderTable
|
||||
{rows
|
||||
? <RenderTable
|
||||
columnsCfg={columns}
|
||||
rowsData={rows}
|
||||
lastRowCfg={lastRow}
|
||||
|
||||
Reference in New Issue
Block a user