From 4864a376c60c2d20d4578d9b4f7edeec8f11e6c3 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Tue, 9 Jul 2024 16:09:05 +0200 Subject: [PATCH] custom grid --- packages/datalib/src/CustomGridDisplay.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/datalib/src/CustomGridDisplay.ts b/packages/datalib/src/CustomGridDisplay.ts index d0c14860a..864783f30 100644 --- a/packages/datalib/src/CustomGridDisplay.ts +++ b/packages/datalib/src/CustomGridDisplay.ts @@ -16,6 +16,7 @@ import { Expression, Select, treeToSql, dumpSqlSelect, ColumnRefExpression } fro export interface CustomGridColumn { columnName: string; columnLabel: string; + isPrimaryKey?: boolean; } export class CustomGridDisplay extends GridDisplay { @@ -38,14 +39,22 @@ export class CustomGridDisplay extends GridDisplay { headerText: col.columnLabel, uniqueName: col.columnName, uniquePath: [col.columnName], - isPrimaryKey: false, + isPrimaryKey: col.isPrimaryKey, isForeignKeyUnique: false, schemaName: tableName.schemaName, 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.sortable = true; - this.groupable = true; + this.groupable = false; this.editable = !isReadOnly; this.supportsReload = true; }