Browse Source

fix: hide newly added column in existing views nocodb/nocodb#7421

pull/7478/head
Ramesh Mane 10 months ago
parent
commit
a73425a995
  1. 2
      packages/nc-gui/components/smartsheet/column/EditOrAdd.vue
  2. 8
      packages/nocodb/src/models/Column.ts
  3. 9
      packages/nocodb/src/models/View.ts

2
packages/nc-gui/components/smartsheet/column/EditOrAdd.vue

@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { ColumnReqType, ColumnType } from 'nocodb-sdk' import type { ColumnReqType, ColumnType } from 'nocodb-sdk'
import { UITypes, isLinksOrLTAR, isSystemColumn, isVirtualCol, isSelfReferencingTableColumn } from 'nocodb-sdk' import { UITypes, isLinksOrLTAR, isSelfReferencingTableColumn, isSystemColumn, isVirtualCol } from 'nocodb-sdk'
import { import {
IsFormInj, IsFormInj,
IsKanbanInj, IsKanbanInj,

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

@ -198,7 +198,13 @@ export default class Column<T = any> implements ColumnType {
fk_column_id: row.id, fk_column_id: row.id,
fk_model_id: column.fk_model_id, fk_model_id: column.fk_model_id,
column_show: { column_show: {
show: false, show:
column.uidt === UITypes.LinkToAnotherRecord ||
(column.uidt === UITypes.Links &&
column.type === 'mm' &&
!column.view_id)
? false
: !column.view_id,
view_id: column.view_id, view_id: column.view_id,
}, },
column_order: column.column_order, column_order: column.column_order,

9
packages/nocodb/src/models/View.ts

@ -551,14 +551,13 @@ export default class View implements ViewType {
for (const view of views) { for (const view of views) {
const modifiedInsertObj = { const modifiedInsertObj = {
...insertObj, ...insertObj,
show: param.column_show?.view_id
? param.column_show?.view_id === view.id
? true
: false
: insertObj.show,
fk_view_id: view.id, fk_view_id: view.id,
}; };
if (param.column_show?.view_id === view.id) {
modifiedInsertObj.show = true;
}
if (param.column_order?.view_id === view.id) { if (param.column_order?.view_id === view.id) {
modifiedInsertObj.order = param.column_order?.order; modifiedInsertObj.order = param.column_order?.order;
} }

Loading…
Cancel
Save