diff --git a/packages/frontend-core/src/components/grid/stores/rows.js b/packages/frontend-core/src/components/grid/stores/rows.js index 3e2b59c633..7317611b5e 100644 --- a/packages/frontend-core/src/components/grid/stores/rows.js +++ b/packages/frontend-core/src/components/grid/stores/rows.js @@ -56,11 +56,8 @@ export const deriveStores = context => { ...row, __idx: idx, ...customColumns.reduce((acc, c) => { - const fromSingle = - $enrichedSchema[c.related.field].relationshipType === - RelationshipType.ONE_TO_MANY - - acc[c.name] = getRelatedTableValues(row, c, fromSingle) + const fromField = $enrichedSchema[c.related.field] + acc[c.name] = getRelatedTableValues(row, c, fromField) return acc }, {}), })) diff --git a/packages/frontend-core/src/utils/relatedColumns.js b/packages/frontend-core/src/utils/relatedColumns.js index f7298614ed..0b04ea9b69 100644 --- a/packages/frontend-core/src/utils/relatedColumns.js +++ b/packages/frontend-core/src/utils/relatedColumns.js @@ -1,4 +1,4 @@ -import { FieldType } from "@budibase/types" +import { FieldType, RelationshipType } from "@budibase/types" import { Helpers } from "@budibase/bbui" const columnTypeManyOverrides = { @@ -21,12 +21,10 @@ const columnTypeManyOverrides = { }, [FieldType.BOOLEAN]: { overridedType: FieldType.STRING, - parser: value => { - if (value) { - return true - } - return false - }, + parser: value => !!value, + }, + [FieldType.SIGNATURE_SINGLE]: { + overridedType: FieldType.ATTACHMENTS, }, } @@ -39,6 +37,9 @@ export function enrichSchemaWithRelColumns(schema) { acc[c] = field if (field.visible !== false && field.columns) { + const fromSingle = + field?.relationshipType === RelationshipType.ONE_TO_MANY + for (const relColumn of Object.keys(field.columns)) { const relField = field.columns[relColumn] if (!relField.visible) { @@ -50,7 +51,8 @@ export function enrichSchemaWithRelColumns(schema) { name, related: { field: c, subField: relColumn }, cellRenderType: - columnTypeManyOverrides[relField.type]?.overridedType || + (!fromSingle && + columnTypeManyOverrides[relField.type]?.overridedType) || relField.type, } } @@ -61,7 +63,10 @@ export function enrichSchemaWithRelColumns(schema) { return result } -export function getRelatedTableValues(row, field, fromSingle) { +export function getRelatedTableValues(row, field, fromField) { + const fromSingle = + fromField?.relationshipType === RelationshipType.ONE_TO_MANY + let result = "" try { if (fromSingle) {