Browse Source

fix(nocodb): rollback previous change + add comment

pull/5578/head
Wing-Kam Wong 2 years ago
parent
commit
a485dbfa8f
  1. 5
      packages/nocodb-nest/src/models/Model.ts

5
packages/nocodb-nest/src/models/Model.ts

@ -78,12 +78,15 @@ export default class Model implements TableType {
return this.columns?.filter((c) => c.pk);
}
// If there is no column marked as display value,
// we are getting the immediate next column to pk as display value
// or the first column(if pk is the last column).
public get displayValue(): Column {
if (!this.columns) return null;
const pCol = this.columns?.find((c) => c.pv);
if (pCol) return pCol;
const pkIndex = this.columns.indexOf(this.primaryKey);
if (pkIndex < this.columns.length - 1) return this.columns[pkIndex];
if (pkIndex < this.columns.length - 1) return this.columns[pkIndex + 1];
return this.columns[0];
}

Loading…
Cancel
Save