custom grid

This commit is contained in:
Jan Prochazka 2024-07-09 16:09:05 +02:00
parent ef77dbf768
commit 4864a376c6

View File

@ -16,6 +16,7 @@ import { Expression, Select, treeToSql, dumpSqlSelect, ColumnRefExpression } fro
export interface CustomGridColumn { export interface CustomGridColumn {
columnName: string; columnName: string;
columnLabel: string; columnLabel: string;
isPrimaryKey?: boolean;
} }
export class CustomGridDisplay extends GridDisplay { export class CustomGridDisplay extends GridDisplay {
@ -38,14 +39,22 @@ export class CustomGridDisplay extends GridDisplay {
headerText: col.columnLabel, headerText: col.columnLabel,
uniqueName: col.columnName, uniqueName: col.columnName,
uniquePath: [col.columnName], uniquePath: [col.columnName],
isPrimaryKey: false, isPrimaryKey: col.isPrimaryKey,
isForeignKeyUnique: false, isForeignKeyUnique: false,
schemaName: tableName.schemaName, schemaName: tableName.schemaName,
pureName: tableName.pureName, pureName: tableName.pureName,
})); }));
this.changeSetKeyFields = columns.filter(x => x.isPrimaryKey).map(x => x.columnName);
this.baseTable = {
...tableName,
columns: this.columns.map(x => ({ ...tableName, columnName: x.columnName, dataType: 'string' })),
foreignKeys: [],
};
this.filterable = true; this.filterable = true;
this.sortable = true; this.sortable = true;
this.groupable = true; this.groupable = false;
this.editable = !isReadOnly; this.editable = !isReadOnly;
this.supportsReload = true; this.supportsReload = true;
} }