Skip to content

Commit dd76870

Browse files
authored
Merge branch 'main' into feature/money-widget-cents-support
2 parents f370e38 + d073b1b commit dd76870

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

frontend/src/app/components/dashboard/db-table-view/db-table-view.component.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,9 +728,17 @@ export class DbTableViewComponent implements OnInit, OnChanges {
728728
onColumnVisibilityChange() {
729729
this.tableData.changleColumnList(this.connectionID, this.name);
730730
this.cdr.detectChanges();
731+
732+
// Send selected columns first, then non-selected at the end
733+
const orderedColumns = [
734+
...this.tableData.columns.filter((col) => col.selected),
735+
...this.tableData.columns.filter((col) => !col.selected),
736+
];
737+
731738
this._tables
732739
.updatePersonalTableViewSettings(this.connectionID, this.name, {
733740
columns_view: this.tableData.displayedDataColumns,
741+
list_fields: orderedColumns.map((col) => col.title),
734742
})
735743
.subscribe({
736744
next: () => {

frontend/src/app/components/db-table-row-edit/db-table-row-edit.component.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,10 @@ export class DbTableRowEditComponent implements OnInit {
198198
return { [field.column_name]: '' };
199199
}),
200200
);
201-
if (res.list_fields.length) {
202-
const shownFieldsList = this.shownRows.map((field: TableField) => field.column_name);
201+
const shownFieldsList = this.shownRows.map((field: TableField) => field.column_name);
202+
if (res.columns_view && res.columns_view.length) {
203+
this.fieldsOrdered = [...res.columns_view].filter((field) => shownFieldsList.includes(field));
204+
} else if (res.list_fields.length) {
203205
this.fieldsOrdered = [...res.list_fields].filter((field) => shownFieldsList.includes(field));
204206
} else {
205207
this.fieldsOrdered = Object.keys(this.tableRowValues).map((key) => key);
@@ -244,8 +246,9 @@ export class DbTableRowEditComponent implements OnInit {
244246
this.tableForeignKeys = res.foreignKeys;
245247
// this.shownRows = res.structure.filter((field: TableField) => !field.column_default?.startsWith('nextval'));
246248
this.tableRowValues = { ...res.row };
247-
if (res.list_fields.length) {
248-
// const shownFieldsList = this.shownRows.map((field: TableField) => field.column_name);
249+
if (res.columns_view && res.columns_view.length) {
250+
this.fieldsOrdered = [...res.columns_view];
251+
} else if (res.list_fields.length) {
249252
this.fieldsOrdered = [...res.list_fields];
250253
} else {
251254
this.fieldsOrdered = Object.keys(this.tableRowValues).map((key) => key);

0 commit comments

Comments
 (0)