Browse Source

fix: fallback using dtxp if no option provided

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/2751/head
mertmit 2 years ago
parent
commit
67f50ccfb1
  1. 8
      packages/nocodb/src/lib/models/Column.ts

8
packages/nocodb/src/lib/models/Column.ts

@ -231,12 +231,12 @@ export default class Column<T = any> implements ColumnType {
break; break;
} }
case UITypes.MultiSelect: { case UITypes.MultiSelect: {
if (column.dt === 'set' && !column.altered) { if (!column.colOptions?.options) {
for (const [i, option] of column.dtxp?.split(',').entries() || [].entries()) { for (const [i, option] of column.dtxp?.split(',').entries() || [].entries()) {
await SelectOption.insert( await SelectOption.insert(
{ {
fk_column_id: colId, fk_column_id: colId,
title: option, title: option.replace(/^'/, '').replace(/'$/, ''),
order: i + 1 order: i + 1
}, },
ncMeta ncMeta
@ -257,12 +257,12 @@ export default class Column<T = any> implements ColumnType {
break; break;
} }
case UITypes.SingleSelect: { case UITypes.SingleSelect: {
if (column.dt === 'enum' && !column.altered) { if (!column.colOptions?.options) {
for (const [i, option] of column.dtxp?.split(',').entries() || [].entries()) { for (const [i, option] of column.dtxp?.split(',').entries() || [].entries()) {
await SelectOption.insert( await SelectOption.insert(
{ {
fk_column_id: colId, fk_column_id: colId,
title: option, title: option.replace(/^'/, '').replace(/'$/, ''),
order: i + 1 order: i + 1
}, },
ncMeta ncMeta

Loading…
Cancel
Save