Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -728,9 +728,17 @@ export class DbTableViewComponent implements OnInit, OnChanges {
onColumnVisibilityChange() {
this.tableData.changleColumnList(this.connectionID, this.name);
this.cdr.detectChanges();

// Send selected columns first, then non-selected at the end
const orderedColumns = [
...this.tableData.columns.filter((col) => col.selected),
...this.tableData.columns.filter((col) => !col.selected),
];

this._tables
.updatePersonalTableViewSettings(this.connectionID, this.name, {
columns_view: this.tableData.displayedDataColumns,
list_fields: orderedColumns.map((col) => col.title),
})
.subscribe({
next: () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,10 @@ export class DbTableRowEditComponent implements OnInit {
return { [field.column_name]: '' };
}),
);
if (res.list_fields.length) {
const shownFieldsList = this.shownRows.map((field: TableField) => field.column_name);
const shownFieldsList = this.shownRows.map((field: TableField) => field.column_name);
if (res.columns_view && res.columns_view.length) {
this.fieldsOrdered = [...res.columns_view].filter((field) => shownFieldsList.includes(field));
Comment on lines +202 to +203
} else if (res.list_fields.length) {
this.fieldsOrdered = [...res.list_fields].filter((field) => shownFieldsList.includes(field));
} else {
this.fieldsOrdered = Object.keys(this.tableRowValues).map((key) => key);
Expand Down Expand Up @@ -244,8 +246,9 @@ export class DbTableRowEditComponent implements OnInit {
this.tableForeignKeys = res.foreignKeys;
// this.shownRows = res.structure.filter((field: TableField) => !field.column_default?.startsWith('nextval'));
this.tableRowValues = { ...res.row };
if (res.list_fields.length) {
// const shownFieldsList = this.shownRows.map((field: TableField) => field.column_name);
if (res.columns_view && res.columns_view.length) {
this.fieldsOrdered = [...res.columns_view];
Comment on lines +249 to +250
} else if (res.list_fields.length) {
this.fieldsOrdered = [...res.list_fields];
} else {
this.fieldsOrdered = Object.keys(this.tableRowValues).map((key) => key);
Expand Down
Loading