Browse Source

fix: disable hide for primary value column

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/5060/head
mertmit 2 years ago
parent
commit
669882636e
  1. 23
      packages/nocodb/src/lib/models/View.ts

23
packages/nocodb/src/lib/models/View.ts

@ -631,15 +631,22 @@ export default class View implements ViewType {
}
const updateObj = extractProps(colData, ['order', 'show']);
const primary_value_column = await ncMeta.metaGet2(null, null, MetaTable.COLUMNS, {
fk_model_id: view.fk_model_id,
pv: true,
});
// keep primary_value_column always visible and first in grid view
if (view.type === ViewTypes.GRID) {
const primary_value_column_meta = await ncMeta.metaGet2(null, null, MetaTable.COLUMNS, {
fk_model_id: view.fk_model_id,
pv: true,
});
// keep primary_value_column always visible and first
if (primary_value_column && primary_value_column.id === colId) {
updateObj.order = 1;
updateObj.show = true;
const primary_value_column = await ncMeta.metaGet2(null, null, MetaTable.GRID_VIEW_COLUMNS, {
fk_view_id: view.id,
fk_column_id: primary_value_column_meta.id,
});
if (primary_value_column && primary_value_column.id === colId) {
updateObj.order = 1;
updateObj.show = true;
}
}
// get existing cache

Loading…
Cancel
Save