diff --git a/frontend/src/AppBuilder/Widgets/Table/columns/autogenerateColumns.js b/frontend/src/AppBuilder/Widgets/Table/columns/autogenerateColumns.js index 83c07fc0ac..98faa12da0 100644 --- a/frontend/src/AppBuilder/Widgets/Table/columns/autogenerateColumns.js +++ b/frontend/src/AppBuilder/Widgets/Table/columns/autogenerateColumns.js @@ -50,7 +50,6 @@ export default function autogenerateColumns( const currentKey = parentKey ? `${parentKey}.${key}` : key; if (isValueIsPlainObject(value)) { // if value is object particularly, then we only want nested keys till one level of nesting - accumulator.push(currentKey); accumulator.push(...limitToOneLevelNestingHelperFunc(value, currentKey)); } else if (isValueIsPremitiveOrArray(value)) { // check if value is premitive or array then simply push current key in the accumulator. @@ -99,7 +98,7 @@ export default function autogenerateColumns( id: uuidv4(), name: key, key: key, - columnType: convertDataTypeToColumnType(dataType, firstRow[key]), + columnType: convertDataTypeToColumnType(dataType), autogenerated: true, })); @@ -124,8 +123,7 @@ const dataTypeToColumnTypeMapping = { boolean: 'boolean', }; -const convertDataTypeToColumnType = (dataType, value) => { +const convertDataTypeToColumnType = (dataType) => { if (Object.keys(dataTypeToColumnTypeMapping).includes(dataType)) return dataTypeToColumnTypeMapping[dataType]; - if (dataType === 'object' && !Array.isArray(value)) return 'json'; else return 'string'; };