form view - find by ID

This commit is contained in:
Jan Prochazka
2021-01-14 19:36:03 +01:00
parent ad4fa77e46
commit 4328107a1d
4 changed files with 103 additions and 30 deletions

View File

@@ -39,7 +39,7 @@ export class TableFormViewDisplay extends FormViewDisplay {
}
getPrimaryKeyEqualCondition(row = null): Condition {
if (!row) row = this.config.formViewKey;
if (!row) row = this.config.formViewKeyRequested || this.config.formViewKey;
if (!row) return null;
const { primaryKey } = this.gridDisplay.baseTable;
if (!primaryKey) return null;
@@ -57,7 +57,7 @@ export class TableFormViewDisplay extends FormViewDisplay {
},
right: {
exprType: 'value',
value: this.config.formViewKey[columnName],
value: row[columnName],
},
})),
};
@@ -166,17 +166,6 @@ export class TableFormViewDisplay extends FormViewDisplay {
return sql;
}
extractKey(row) {
if (!row || !this.gridDisplay.baseTable || !this.gridDisplay.baseTable.primaryKey) {
return null;
}
const formViewKey = _.pick(
row,
this.gridDisplay.baseTable.primaryKey.columns.map((x) => x.columnName)
);
return formViewKey;
}
navigate(row) {
const formViewKey = this.extractKey(row);
this.setConfig((cfg) => ({